﻿namespace QLBanHang.UC
{
    using DevExpress.Data;
    using DevExpress.Utils;
    using DevExpress.XtraEditors;
    using DevExpress.XtraEditors.Controls;
    using DevExpress.XtraEditors.Mask;
    using DevExpress.XtraEditors.Repository;
    using DevExpress.XtraGrid;
    using DevExpress.XtraGrid.Columns;
    using DevExpress.XtraGrid.Views.Base;
    using DevExpress.XtraGrid.Views.Grid;
    using DevExpress.XtraReports.UI;
    using DevExpress.XtraTab;
    using Access;
    using Access.Duoc;
    using BaseClass.Duoc;
    using Report;
    using System;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Windows.Forms;
    using UserControls;

    public class ucd_xuatkho_banle : XtraUserControl
    {
        private long _idxuatban;
        private int _iiddangnhap;
        private DXuatBanLe _xuatban;
        private General _xuli;
        private SimpleButton btnboqua;
        private SimpleButton btnhuy;
        private SimpleButton btnin;
        private SimpleButton btnketthuc;
        private SimpleButton btnluu;
        private SimpleButton btnmoi;
        private SimpleButton btnsua;
        private SimpleButton btnthem;
        private SimpleButton btntim;
        private SimpleButton btnxoa;
        private LookUpEdit cbbgioitinh;
        private LookUpEdit cbbnhomkh;
        private IContainer components;
        private ctrdanhsach ctrdanhsach_vp;
        private DateEdit datedenngay;
        private DateEdit datehandung;
        private DateEdit datengay;
        private DateEdit datetungay;
        private GridControl gridds;
        private GridColumn gridds_dongia;
        private GridColumn gridds_dvt;
        private GridColumn gridds_giaban;
        private GridColumn gridds_handung;
        private GridColumn gridds_hangsx;
        private GridColumn gridds_id;
        private GridColumn gridds_idnhapct;
        private GridColumn gridds_idvitrikho;
        private GridColumn gridds_losx;
        private GridColumn gridds_ma;
        private GridColumn gridds_slxuat;
        private GridColumn gridds_soluong;
        private GridColumn gridds_ten;
        private GridColumn gridds_tenhoatchat;
        private GridColumn gridds_tenvitrikho;
        private GridColumn gridds_thanhtien;
        private GridColumn gridds_thue;
        private GridColumn gridds_tongtien;
        private GridControl gridsp;
        private GridColumn gridsp_id;
        private GridColumn gridsp_ngay;
        private GridColumn gridsp_sophieu;
        private GridView gridView1;
        private GridView gridView2;
        private GroupControl groupControl1;
        private Label label1;
        private Label label10;
        private Label label11;
        private Label label12;
        private Label label13;
        private Label label14;
        private Label label15;
        private Label label16;
        private Label label17;
        private Label label18;
        private Label label19;
        private Label label2;
        private Label label20;
        private Label label21;
        private Label label22;
        private Label label23;
        private Label label24;
        private Label label25;
        private Label label26;
        private Label label27;
        private Label label28;
        private Label label3;
        private Label label4;
        private Label label5;
        private Label label6;
        private Label label7;
        private Label label8;
        private Label label9;
        private Label lblmaso;
        private NumericUpDown nummiengiam;
        private NumericUpDown numnamsinh;
        private NumericUpDown numthue;
        private RepositoryItemTextEdit repositoryItemTextEdit1;
        private RepositoryItemTextEdit repositoryItemTextEdit2;
        private RepositoryItemTextEdit repositoryItemTextEdit3;
        private RepositoryItemTextEdit repositoryItemTextEdit4;
        private UCTextBoxNumeric tbnumdongia;
        private UCTextBoxNumeric tbnumsoluong;
        private UCTextBoxNumeric tbnumsotien;
        private UCTextBoxNumeric tbnumthanhtien;
        private UCTextBoxNumeric tbnumtienthue;
        private UCTextBoxNumeric tbnumtongmiengiam;
        private UCTextBoxNumeric tbnumtongthucthu;
        private UCTextBoxNumeric tbnumtongtien;
        private UCTextBoxNumeric tbnumtuoi;
        private TextEdit txtdiachi;
        private TextEdit txtdvt;
        private TextEdit txthangsx;
        private TextEdit txthoten;
        private TextEdit txtlosx;
        private TextEdit txtma;
        private TextEdit txtsophieu;
        private TextEdit txtten;
        private TextEdit txttenhoatchat;
        private TextEdit txtvitrikhoten;

        public ucd_xuatkho_banle()
        {
            this._idxuatban = 0L;
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = new General();
        }

        public ucd_xuatkho_banle(int iddangnhap)
        {
            this._idxuatban = 0L;
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = new General();
            this._iiddangnhap = iddangnhap;
        }

        public ucd_xuatkho_banle(General xuli, int iddangnhap)
        {
            this._idxuatban = 0L;
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = xuli;
            this._iiddangnhap = iddangnhap;
        }

        public ucd_xuatkho_banle(General xuli, long idnhapkho, int iddangnhap)
        {
            this._idxuatban = 0L;
            this._iiddangnhap = 0;
            this.components = null;
            this.InitializeComponent();
            this._xuli = xuli;
            this._idxuatban = idnhapkho;
            this._iiddangnhap = iddangnhap;
        }

        private void btnboqua_Click(object sender, EventArgs e)
        {
            this.f_Control_enable(false);
        }

        private void btnhuy_Click(object sender, EventArgs e)
        {
            if (this.txtsophieu.Tag.ToString() != "0")
            {
                dtoDXuatBanLe xuatban = new dtoDXuatBanLe(this._xuli.pConFigData) {
                    pID = long.Parse(this.txtsophieu.Tag.ToString())
                };
                xuatban.Load();
                if (!this._xuatban.f_huy_xuatbanle(xuatban))
                {
                    MessageBox.Show("Hủy kh\x00f4ng th\x00e0nh c\x00f4ng.", "Th\x00f4ng b\x00e1o");
                }
                else
                {
                    MessageBox.Show("Hủy th\x00e0nh c\x00f4ng.", "Th\x00f4ng b\x00e1o");
                    this.btntim_Click(null, null);
                    this.f_setcontrol_xuatbanle(long.Parse(this.txtsophieu.Tag.ToString()));
                    this.f_loaddata_xuatbanlect(long.Parse(this.txtsophieu.Tag.ToString()));
                    this.f_Control_enable(false);
                }
            }
        }

        private void btnin_Click(object sender, EventArgs e)
        {
            DataTable table = this._xuatban.f_loaddata_xuatban(long.Parse(this.txtsophieu.Tag.ToString()), "", "");
            table.TableName = "sophieu";
            DataTable table2 = this._xuatban.f_loaddata_xuatbanct(long.Parse(this.txtsophieu.Tag.ToString()));
            table2.TableName = "chitiet";
            table2.Columns.Add("sophieu");
            table2.Columns.Add("tennguoidangnhap");
            table2.Columns.Add("hoten");
            table2.Columns.Add("gioitinh");
            table2.Columns.Add("namsinh");
            table2.Columns.Add("diachi");
            for (int i = 0; i < table2.Rows.Count; i++)
            {
                table2.Rows[i]["sophieu"] = this.txtsophieu.Text;
                table2.Rows[i]["tennguoidangnhap"] = table.Rows[0]["tennguoidangnhap"].ToString();
                table2.Rows[i]["hoten"] = this.txthoten.Text;
                table2.Rows[i]["gioitinh"] = this.cbbgioitinh.Text;
                table2.Rows[i]["namsinh"] = Convert.ToInt16(this.numnamsinh.Value).ToString();
                table2.Rows[i]["diachi"] = this.txtdiachi.Text;
            }
            DataSet ds = new DataSet();
            ds.Tables.Add(table2.Copy());
            ds.WriteXml("d_inphieuxuatban.xml", XmlWriteMode.WriteSchema);
            repx_d_in_phieuxuatban report = new repx_d_in_phieuxuatban();
            report.Load(ds);
            report.ShowPreviewDialog();
            int iPrinted = report.iPrinted;
        }

        private void btnketthuc_Click(object sender, EventArgs e)
        {
            try
            {
                XtraTabPage parent = (XtraTabPage) base.Parent;
                XtraTabControl control = (XtraTabControl) parent.Parent;
                control.TabPages.Remove(parent);
            }
            catch
            {
                XtraUserControl control2 = (XtraUserControl) base.Parent;
                control2.Controls.Remove(this);
            }
        }

        private void btnluu_Click(object sender, EventArgs e)
        {
            dtoDXuatBanLeCT ect = new dtoDXuatBanLeCT(this._xuli.pConFigData);
            DataTable dataSource = (DataTable) this.gridds.DataSource;
            dtoDXuatBanLeCT[] chitiet = new dtoDXuatBanLeCT[dataSource.Rows.Count];
            for (int i = 0; i < dataSource.Rows.Count; i++)
            {
                ect = new dtoDXuatBanLeCT(this._xuli.pConFigData);
                try
                {
                    ect.pDONGIA = decimal.Parse(dataSource.Rows[i][this.gridds_dongia.FieldName].ToString());
                }
                catch
                {
                    ect.pDONGIA = 0M;
                }
                ect.pSOLUONG = decimal.Parse(dataSource.Rows[i][this.gridds_soluong.FieldName].ToString());
                ect.pIDDUOCPHAM = int.Parse(dataSource.Rows[i][this.gridds_id.FieldName].ToString());
                ect.pIDXUATKHOBANLE = long.Parse(this.txtsophieu.Tag.ToString());
                ect.pIDDANGNHAP = this._iiddangnhap;
                ect.pTHUE = decimal.Parse(dataSource.Rows[i][this.gridds_thue.FieldName].ToString());
                chitiet[i] = ect;
            }
            dtoDXuatBanLe xuatban = new dtoDXuatBanLe(this._xuli.pConFigData) {
                pHOTEN = this.txthoten.Text,
                pID = long.Parse(this.txtsophieu.Tag.ToString()),
                pIDDANGNHAP = this._iiddangnhap,
                pIDGIOITINH = int.Parse(this.cbbgioitinh.EditValue.ToString()),
                pIDLOAIXUAT = 0,
                pNAMSINH = Convert.ToInt16(this.numnamsinh.Value).ToString(),
                pNGAY = this.datengay.Text,
                pTENMAYTINH = Environment.MachineName,
                pSOPHIEU = long.Parse(this.txtsophieu.Text),
                pTONGTIEN = this.tbnumtongtien.Values,
                pDIACHI = this.txtdiachi.Text,
                pCHIETKHAU = this.nummiengiam.Value
            };
            DXuatBanLe le2 = new DXuatBanLe(this._xuli.pConFigData);
            if (xuatban.pID == 0L)
            {
                this.txtsophieu.Tag = le2.f_insert_xuatbanle(xuatban, chitiet, (HangSo.NhomKhachHang.enNhomKhachHang) this.cbbnhomkh.EditValue).ToString();
                if (this.txtsophieu.Tag.ToString() == "0")
                {
                    MessageBox.Show("Kh\x00f4ng lưu được th\x00f4ng tin phiếu xuất b\x00e1n.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    return;
                }
            }
            this.btntim_Click(null, null);
            this.f_setcontrol_xuatbanle(long.Parse(this.txtsophieu.Tag.ToString()));
            this.f_loaddata_xuatbanlect(long.Parse(this.txtsophieu.Tag.ToString()));
            this.f_Loaddata_dmvp();
            this.f_Control_enable(false);
        }

        private void btnmoi_Click(object sender, EventArgs e)
        {
            this.f_Add_ChiTiet();
            this.f_Loadcontrol_dmvp(0L, "", "", "", "", 0M);
            this.f_Loadcontrol_xuatbanlechitiet(0L, 0M, 0M, 0M, 0M, 0M, 0M, "", DateTime.Now.ToString("dd/MM/yyyy"), "", "");
            base.ActiveControl = this.txtma;
        }

        private void btnmoi_Click_1(object sender, EventArgs e)
        {
            this.f_Control_enable(true);
            this.datengay.EditValue = DateTime.Now;
            this.f_Loadcontrol_xuatbanle(0L, "", DateTime.Now.ToString("dd/MM/yyyy HH:mm"), "", 0, 0, DateTime.Now.Year, "", 0M, 0M, 0M, 0M);
            this.f_loaddata_xuatbanlect(0L);
            this.f_Loadcontrol_dmvp(0L, "", "", "", "", 0M);
            this.f_Loadcontrol_xuatbanlechitiet(0L, 0M, 0M, 0M, 0M, 0M, 0M, "", DateTime.Now.ToString("dd/MM/yyyy"), "", "");
            this.f_Loaddata_dmvp();
            this.txtsophieu.Enabled = true;
            base.ActiveControl = this.txtsophieu;
        }

        private void btnsua_Click(object sender, EventArgs e)
        {
            this.f_Control_enable(true);
            this.txtsophieu.Enabled = false;
            this.txtten.Focus();
        }

        private void btntim_Click(object sender, EventArgs e)
        {
            this.gridsp.DataSource = this._xuatban.f_loaddata_xuatban(0L, this.datetungay.Text, this.datedenngay.Text);
        }

        private void btnxoa_Click(object sender, EventArgs e)
        {
            try
            {
                this.gridView1.DeleteSelectedRows();
            }
            catch
            {
            }
        }

        private void ctrdanhsach_vp_Validated(object sender, EventArgs e)
        {
            try
            {
                DataTable dongHienTai = this.ctrdanhsach_vp.DongHienTai;
                this.f_SetControl_dmsanpham(long.Parse(dongHienTai.Rows[0]["iddp"].ToString()));
            }
            catch
            {
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void f_Add_ChiTiet()
        {
            if ((this.txtma.Tag != null) && (this.txtma.Tag.ToString() != "0"))
            {
                DataTable dataSource = (DataTable) this.gridds.DataSource;
                DataRow row = dataSource.NewRow();
                row[this.gridds_idnhapct.FieldName] = 0;
                row[this.gridds_ma.FieldName] = this.txtma.Text;
                row[this.gridds_ten.FieldName] = this.txtten.Text;
                row[this.gridds_dvt.FieldName] = this.txtdvt.Text;
                row[this.gridds_id.FieldName] = this.txtma.Tag.ToString();
                row[this.gridds_soluong.FieldName] = this.tbnumsoluong.Values;
                row[this.gridds_dongia.FieldName] = this.tbnumdongia.Values.ToString();
                row[this.gridds_thanhtien.FieldName] = decimal.Parse(row[this.gridds_dongia.FieldName].ToString()) * decimal.Parse(row[this.gridds_soluong.FieldName].ToString());
                row[this.gridds_thue.FieldName] = this.numthue.Value;
                row[this.gridds_thanhtien.FieldName] = this.tbnumthanhtien.Values;
                row[this.gridds_losx.FieldName] = this.txtlosx.Text;
                row[this.gridds_handung.FieldName] = this.datehandung.Text;
                row[this.gridds_tenvitrikho.FieldName] = this.txtvitrikhoten.Text;
                DataRow[] rowArray = ((DataTable) this.gridds.DataSource).Select(this.gridds_id.FieldName + "=" + row[this.gridds_id.FieldName].ToString());
                if (rowArray.Length > 0)
                {
                    if (decimal.Parse(rowArray[0][this.gridds_slxuat.FieldName].ToString()) != 0M)
                    {
                        MessageBox.Show("T\x00ean viện ph\x00ed '" + row[this.gridds_ten.FieldName].ToString().ToUpper() + "' đ\x00e3 thanh to\x00e1n.\nKh\x00f4ng cập nhật lại th\x00f4ng tin viện ph\x00ed n\x00e0y.", "Th\x00f4ng b\x00e1o", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else if (MessageBox.Show("T\x00ean viện ph\x00ed '" + row[this.gridds_ten.FieldName].ToString().ToUpper() + "' đ\x00e3 tồn tại.\nBạn c\x00f3 muốn cập nhật lại th\x00f4ng tin viện ph\x00ed n\x00e0y kh\x00f4ng?", "Th\x00f4ng b\x00e1o", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes)
                    {
                        rowArray[0][this.gridds_dongia.FieldName] = row[this.gridds_dongia.FieldName].ToString();
                        rowArray[0][this.gridds_soluong.FieldName] = row[this.gridds_soluong.FieldName].ToString();
                        rowArray[0][this.gridds_thanhtien.FieldName] = row[this.gridds_thanhtien.FieldName].ToString();
                    }
                }
                else
                {
                    dataSource.Rows.Add(row);
                }
                this.gridds.DataSource = dataSource;
                this.f_tinhtongtien();
            }
        }

        private void f_Control_enable(bool chophep)
        {
            this.btnluu.Enabled = this.btnboqua.Enabled = this.btnthem.Enabled = this.btnxoa.Enabled = this.tbnumtuoi.Enabled = this.numnamsinh.Enabled = this.nummiengiam.Enabled = this.tbnumtongmiengiam.Enabled = chophep;
            this.btnhuy.Enabled = this.btnsua.Enabled = this.btnketthuc.Enabled = this.btnmoi.Enabled = this.btnin.Enabled = !chophep;
            this.txtsophieu.Properties.ReadOnly = this.txthoten.Properties.ReadOnly = this.datengay.Properties.ReadOnly = this.cbbgioitinh.Properties.ReadOnly = this.cbbnhomkh.Properties.ReadOnly = this.txtdiachi.Properties.ReadOnly = !chophep;
        }

        private void f_load_gioitinh()
        {
            try
            {
                this.cbbgioitinh.Properties.DataSource = HangSo.GioiTinh.f_DanhSach();
                this.cbbgioitinh.Properties.DisplayMember = "ten";
                this.cbbgioitinh.Properties.ValueMember = "id";
                this.cbbgioitinh.ItemIndex = 0;
            }
            catch
            {
            }
        }

        private void f_load_nhomkh()
        {
            try
            {
                this.cbbnhomkh.Properties.DataSource = HangSo.NhomKhachHang.f_DanhSach();
                this.cbbnhomkh.Properties.DisplayMember = "ten";
                this.cbbnhomkh.Properties.ValueMember = "id";
                this.cbbnhomkh.ItemIndex = 0;
            }
            catch
            {
            }
        }

        private void f_Loadcontrol_dmvp(long id, string ma, string ten, string tenhoatchat, string dvt, decimal dongia)
        {
            this.txtma.Text = ma;
            this.txtma.Tag = id.ToString();
            this.txtten.Text = ten;
            this.txtdvt.Text = dvt;
            this.txttenhoatchat.Text = tenhoatchat;
            this.tbnumdongia.Values = dongia;
        }

        private void f_Loadcontrol_xuatbanle(long id, string sophieu, string ngay, string hoten, int gioitinh, int tuoi, int namsinh, string diachi, decimal miengiam, decimal tongmiengiam, decimal tongtien, decimal tongthucthu)
        {
            this.txtsophieu.Tag = id.ToString();
            this.txtsophieu.Text = sophieu;
            try
            {
                this.datengay.EditValue = new DateTime(int.Parse(ngay.Substring(6, 4)), int.Parse(ngay.Substring(3, 2)), int.Parse(ngay.Substring(0, 2)), int.Parse(ngay.Substring(11, 2)), int.Parse(ngay.Substring(14, 2)), 0);
            }
            catch
            {
            }
            this.txthoten.Text = hoten;
            this.cbbgioitinh.EditValue = gioitinh;
            this.tbnumtuoi.Values = Convert.ToDecimal(tuoi);
            this.numnamsinh.Value = namsinh;
            this.txtdiachi.Text = diachi;
            this.nummiengiam.Value = miengiam;
            this.tbnumtongmiengiam.Values = tongmiengiam;
            this.tbnumtongtien.Values = tongtien;
            this.tbnumtongthucthu.Values = tongthucthu;
        }

        private void f_Loadcontrol_xuatbanlechitiet(long id, decimal soluong, decimal dongia, decimal sotien, decimal thue, decimal tienthue, decimal giaban, string losx, string handung, string hangsx, string tenvitrikho)
        {
            this.lblmaso.Tag = id.ToString();
            this.tbnumsoluong.Values = soluong;
            this.tbnumdongia.Values = dongia;
            this.tbnumsotien.Values = sotien;
            this.numthue.Value = thue;
            this.tbnumtienthue.Values = tienthue;
            this.tbnumthanhtien.Values = sotien + tienthue;
            this.txtlosx.Text = losx;
            try
            {
                this.datehandung.EditValue = new DateTime(int.Parse(handung.Substring(6, 4)), int.Parse(handung.Substring(3, 2)), int.Parse(handung.Substring(0, 2)));
            }
            catch
            {
            }
            this.tbnumsoluong_Validated(null, null);
            this.txthangsx.Text = hangsx;
            this.txtvitrikhoten.Text = tenvitrikho;
        }

        private void f_Loaddata_dmvp()
        {
            try
            {
                this.ctrdanhsach_vp.SetDataSource = new DTonKho(this._xuli.pConFigData).f_load_tonkhotonghop().Tables[0];
                this.ctrdanhsach_vp.DanhSachCotHienThi = "madp,tendp,dvt,giaban,soluongton";
            }
            catch
            {
            }
        }

        private void f_loaddata_xuatbanlect(long idxuatban)
        {
            DataTable table = this._xuatban.f_loaddata_xuatbanct(idxuatban);
            this.gridds.DataSource = table;
            decimal num = 0M;
            for (int i = 0; i < table.Rows.Count; i++)
            {
                num += decimal.Parse(table.Rows[i][this.gridds_thanhtien.FieldName].ToString()) * (1+decimal.Parse(table.Rows[i][this.gridds_thue.FieldName].ToString()) / 100M);
            }
            this.tbnumtongtien.Values = num;
            this.nummiengiam_Validated(null, null);
        }

        private void f_loadinfo_chidinhchitiet(int indexrow)
        {
            try
            {
                this.f_Loadcontrol_dmvp(long.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_id).ToString()), this.gridView1.GetRowCellValue(indexrow, this.gridds_ma).ToString(), this.gridView1.GetRowCellValue(indexrow, this.gridds_ten).ToString(), this.gridView1.GetRowCellValue(indexrow, this.gridds_tenhoatchat).ToString(), this.gridView1.GetRowCellValue(indexrow, this.gridds_dvt).ToString(), decimal.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_dongia).ToString()));
                this.f_Loadcontrol_xuatbanlechitiet(long.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_idnhapct).ToString()), decimal.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_soluong).ToString()), decimal.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_dongia).ToString()), decimal.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_thanhtien).ToString()), decimal.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_thue).ToString()), decimal.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_thanhtien).ToString()), decimal.Parse(this.gridView1.GetRowCellValue(indexrow, this.gridds_giaban).ToString()), this.gridView1.GetRowCellValue(indexrow, this.gridds_losx).ToString(), this.gridView1.GetRowCellValue(indexrow, this.gridds_handung).ToString(), this.gridView1.GetRowCellValue(indexrow, this.gridds_hangsx).ToString(), this.gridView1.GetRowCellValue(indexrow, this.gridds_tenvitrikho).ToString());
            }
            catch
            {
            }
        }

        private void f_SetControl_dmsanpham(long idvp)
        {
            try
            {
                DataRow[] rowArray = this.ctrdanhsach_vp.SetDataSource.Select("iddp=" + idvp.ToString());
                this.f_Loadcontrol_dmvp(idvp, rowArray[0]["madp"].ToString(), rowArray[0]["tendp"].ToString(), rowArray[0]["tenhoatchat"].ToString(), rowArray[0]["dvt"].ToString(), decimal.Parse(rowArray[0]["giaban"].ToString()));
            }
            catch
            {
                this.f_Loadcontrol_dmvp(0L, "", "", "", "", 0M);
            }
        }

        private void f_setcontrol_xuatbanle(long id)
        {
            dtoDXuatBanLe le = new dtoDXuatBanLe(this._xuli.pConFigData) {
                pID = id
            };
            le.Load();
            try
            {
                decimal tongmiengiam = (le.pCHIETKHAU / 100M) * le.pTONGTIEN;
                this.f_Loadcontrol_xuatbanle(le.pID, le.pSOPHIEU.ToString(), le.pNGAY, le.pHOTEN, le.pIDGIOITINH, DateTime.Now.Year - int.Parse(le.pNAMSINH), int.Parse(le.pNAMSINH), le.pDIACHI, le.pCHIETKHAU, tongmiengiam, le.pTONGTIEN, le.pTONGTIEN - tongmiengiam);
            }
            catch
            {
                this.f_Loadcontrol_xuatbanle(0L, "", DateTime.Now.ToString("dd/MM/yyyy HH:mm"), "", HangSo.enGioiTinh.Nam.GetHashCode(), 0, DateTime.Now.Year, "", 0M, 0M, 0M, 0M);
            }
        }

        private void f_tinhtongtien()
        {
            try
            {
                decimal num = 0M;
                decimal num2 = 0M;
                DataTable dataSource = (DataTable) this.gridds.DataSource;
                for (int i = 0; i < dataSource.Rows.Count; i++)
                {
                    num += decimal.Parse(dataSource.Rows[i][this.gridds_thanhtien.FieldName].ToString());
                    num2 += decimal.Parse(dataSource.Rows[i][this.gridds_thanhtien.FieldName].ToString()) * (1+decimal.Parse(dataSource.Rows[i][this.gridds_thue.FieldName].ToString()) / 100M);
                }
                this.tbnumtongtien.Values = num;
                this.tbnumtongthucthu.Values = num2;
            }
            catch
            {
            }
        }

        private void gridView1_CustomSummaryCalculate(object sender, CustomSummaryEventArgs e)
        {
        }

        private void gridView1_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            int indexrow = 0;
            try
            {
                if (this.gridView1.IsFocusedView)
                {
                    indexrow = this.gridView1.GetSelectedRows()[0];
                    this.f_loadinfo_chidinhchitiet(indexrow);
                }
            }
            catch
            {
            }
        }

        private void gridView1_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
        }

        private void gridView2_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e)
        {
            try
            {
                if (!this.btnluu.Enabled)
                {
                    int rowHandle = this.gridView2.GetSelectedRows()[0];
                    this._idxuatban = long.Parse(this.gridView2.GetRowCellValue(rowHandle, this.gridsp_id).ToString());
                    this.txtsophieu.Tag = this._idxuatban;
                    this.f_setcontrol_xuatbanle(this._idxuatban);
                    this.f_loaddata_xuatbanlect(this._idxuatban);
                }
            }
            catch
            {
            }
        }

        private void InitializeComponent()
        {
            ComponentResourceManager manager = new ComponentResourceManager(typeof(ucd_xuatkho_banle));
            StyleFormatCondition condition = new StyleFormatCondition();
            StyleFormatCondition condition2 = new StyleFormatCondition();
            this.gridds_dongia = new GridColumn();
            this.repositoryItemTextEdit2 = new RepositoryItemTextEdit();
            this.lblmaso = new Label();
            this.txtma = new TextEdit();
            this.txtten = new TextEdit();
            this.txtdvt = new TextEdit();
            this.btnthem = new SimpleButton();
            this.btnluu = new SimpleButton();
            this.btnsua = new SimpleButton();
            this.btnhuy = new SimpleButton();
            this.btnketthuc = new SimpleButton();
            this.gridView1 = new GridView();
            this.gridds_ma = new GridColumn();
            this.repositoryItemTextEdit1 = new RepositoryItemTextEdit();
            this.gridds_ten = new GridColumn();
            this.gridds_dvt = new GridColumn();
            this.gridds_id = new GridColumn();
            this.gridds_soluong = new GridColumn();
            this.gridds_thanhtien = new GridColumn();
            this.gridds_idnhapct = new GridColumn();
            this.gridds_slxuat = new GridColumn();
            this.gridds_tenhoatchat = new GridColumn();
            this.gridds_giaban = new GridColumn();
            this.gridds_losx = new GridColumn();
            this.gridds_handung = new GridColumn();
            this.gridds_hangsx = new GridColumn();
            this.gridds_idvitrikho = new GridColumn();
            this.gridds_thue = new GridColumn();
            this.gridds_tenvitrikho = new GridColumn();
            this.gridds = new GridControl();
            this.btnboqua = new SimpleButton();
            this.label1 = new Label();
            this.txtsophieu = new TextEdit();
            this.label6 = new Label();
            this.txthoten = new TextEdit();
            this.ctrdanhsach_vp = new ctrdanhsach();
            this.label10 = new Label();
            this.tbnumdongia = new UCTextBoxNumeric();
            this.txttenhoatchat = new TextEdit();
            this.label2 = new Label();
            this.label14 = new Label();
            this.label15 = new Label();
            this.label16 = new Label();
            this.txthangsx = new TextEdit();
            this.tbnumsoluong = new UCTextBoxNumeric();
            this.label8 = new Label();
            this.datengay = new DateEdit();
            this.label17 = new Label();
            this.label18 = new Label();
            this.txtdiachi = new TextEdit();
            this.label19 = new Label();
            this.tbnumtongtien = new UCTextBoxNumeric();
            this.label20 = new Label();
            this.tbnumtongthucthu = new UCTextBoxNumeric();
            this.label4 = new Label();
            this.tbnumsotien = new UCTextBoxNumeric();
            this.label5 = new Label();
            this.numthue = new NumericUpDown();
            this.label7 = new Label();
            this.label12 = new Label();
            this.tbnumtienthue = new UCTextBoxNumeric();
            this.label13 = new Label();
            this.tbnumthanhtien = new UCTextBoxNumeric();
            this.label21 = new Label();
            this.txtlosx = new TextEdit();
            this.label22 = new Label();
            this.datehandung = new DateEdit();
            this.label23 = new Label();
            this.txtvitrikhoten = new TextEdit();
            this.btnmoi = new SimpleButton();
            this.btnxoa = new SimpleButton();
            this.label25 = new Label();
            this.cbbgioitinh = new LookUpEdit();
            this.tbnumtuoi = new UCTextBoxNumeric();
            this.label26 = new Label();
            this.numnamsinh = new NumericUpDown();
            this.tbnumtongmiengiam = new UCTextBoxNumeric();
            this.label9 = new Label();
            this.label3 = new Label();
            this.nummiengiam = new NumericUpDown();
            this.label24 = new Label();
            this.groupControl1 = new GroupControl();
            this.datetungay = new DateEdit();
            this.datedenngay = new DateEdit();
            this.label27 = new Label();
            this.label11 = new Label();
            this.btntim = new SimpleButton();
            this.gridsp = new GridControl();
            this.gridView2 = new GridView();
            this.gridsp_id = new GridColumn();
            this.gridsp_ngay = new GridColumn();
            this.gridsp_sophieu = new GridColumn();
            this.repositoryItemTextEdit3 = new RepositoryItemTextEdit();
            this.repositoryItemTextEdit4 = new RepositoryItemTextEdit();
            this.btnin = new SimpleButton();
            this.label28 = new Label();
            this.cbbnhomkh = new LookUpEdit();
            this.gridds_tongtien = new GridColumn();
            this.repositoryItemTextEdit2.BeginInit();
            this.txtma.Properties.BeginInit();
            this.txtten.Properties.BeginInit();
            this.txtdvt.Properties.BeginInit();
            this.gridView1.BeginInit();
            this.repositoryItemTextEdit1.BeginInit();
            this.gridds.BeginInit();
            this.txtsophieu.Properties.BeginInit();
            this.txthoten.Properties.BeginInit();
            this.txttenhoatchat.Properties.BeginInit();
            this.txthangsx.Properties.BeginInit();
            this.datengay.Properties.VistaTimeProperties.BeginInit();
            this.datengay.Properties.BeginInit();
            this.txtdiachi.Properties.BeginInit();
            this.numthue.BeginInit();
            this.txtlosx.Properties.BeginInit();
            this.datehandung.Properties.VistaTimeProperties.BeginInit();
            this.datehandung.Properties.BeginInit();
            this.txtvitrikhoten.Properties.BeginInit();
            this.cbbgioitinh.Properties.BeginInit();
            this.numnamsinh.BeginInit();
            this.nummiengiam.BeginInit();
            this.groupControl1.BeginInit();
            this.groupControl1.SuspendLayout();
            this.datetungay.Properties.VistaTimeProperties.BeginInit();
            this.datetungay.Properties.BeginInit();
            this.datedenngay.Properties.VistaTimeProperties.BeginInit();
            this.datedenngay.Properties.BeginInit();
            this.gridsp.BeginInit();
            this.gridView2.BeginInit();
            this.repositoryItemTextEdit3.BeginInit();
            this.repositoryItemTextEdit4.BeginInit();
            this.cbbnhomkh.Properties.BeginInit();
            base.SuspendLayout();
            this.gridds_dongia.Caption = "Đơn gi\x00e1";
            this.gridds_dongia.ColumnEdit = this.repositoryItemTextEdit2;
            this.gridds_dongia.FieldName = "giaban";
            this.gridds_dongia.Name = "gridds_dongia";
            this.gridds_dongia.Visible = true;
            this.gridds_dongia.VisibleIndex = 3;
            this.gridds_dongia.Width = 0x42;
            this.repositoryItemTextEdit2.AutoHeight = false;
            this.repositoryItemTextEdit2.DisplayFormat.FormatString = "n0";
            this.repositoryItemTextEdit2.DisplayFormat.FormatType = FormatType.Numeric;
            this.repositoryItemTextEdit2.EditFormat.FormatType = FormatType.Numeric;
            this.repositoryItemTextEdit2.Mask.EditMask = "n0";
            this.repositoryItemTextEdit2.Mask.MaskType = MaskType.Numeric;
            this.repositoryItemTextEdit2.Name = "repositoryItemTextEdit2";
            this.lblmaso.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.lblmaso.Font = new Font("Tahoma", 10f);
            this.lblmaso.Location = new Point(4, 0x170);
            this.lblmaso.Name = "lblmaso";
            this.lblmaso.Size = new Size(0x60, 0x13);
            this.lblmaso.TabIndex = 2;
            this.lblmaso.Text = "Dược phẩm:";
            this.lblmaso.TextAlign = ContentAlignment.TopRight;
            this.txtma.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.txtma.Location = new Point(0x60, 0x16f);
            this.txtma.Name = "txtma";
            this.txtma.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtma.Size = new Size(0x6a, 20);
            this.txtma.TabIndex = 12;
            this.txtma.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.txtma.Validated += new EventHandler(this.txtma_Validated);
            this.txtten.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.txtten.Location = new Point(0xca, 0x16f);
            this.txtten.Name = "txtten";
            this.txtten.Size = new Size(0x22e, 20);
            this.txtten.TabIndex = 13;
            this.txtten.TextChanged += new EventHandler(this.txtten_TextChanged);
            this.txtten.Enter += new EventHandler(this.txtten_Enter);
            this.txtten.KeyDown += new KeyEventHandler(this.txtten_KeyDown);
            this.txtten.Validated += new EventHandler(this.txtten_Validated);
            this.txtdvt.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.txtdvt.EditValue = "";
            this.txtdvt.Enabled = false;
            this.txtdvt.Location = new Point(0xa2, 0x189);
            this.txtdvt.Name = "txtdvt";
            this.txtdvt.Size = new Size(40, 20);
            this.txtdvt.TabIndex = 20;
            this.txtdvt.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.btnthem.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnthem.Appearance.Options.UseTextOptions = true;
            this.btnthem.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnthem.Image = Resources.Reso.imgadd;// (Image)manager.GetObject("btnthem.Image");
            this.btnthem.Location = new Point(0x55, 0x1c8);
            this.btnthem.Name = "btnthem";
            this.btnthem.Size = new Size(0x4b, 0x17);
            this.btnthem.TabIndex = 0x1a;
            this.btnthem.Text = " &Th\x00eam [F2]";
            this.btnthem.Click += new EventHandler(this.btnmoi_Click);
            this.btnluu.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnluu.Appearance.Options.UseTextOptions = true;
            this.btnluu.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnluu.Image = Resources.Reso.imgsave;// (Image)manager.GetObject("btnluu.Image");
            this.btnluu.Location = new Point(0xe8, 0x1c8);
            this.btnluu.Name = "btnluu";
            this.btnluu.Size = new Size(0x4b, 0x17);
            this.btnluu.TabIndex = 0x1b;
            this.btnluu.Text = " &Lưu [F5]";
            this.btnluu.Click += new EventHandler(this.btnluu_Click);
            this.btnsua.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnsua.Appearance.Options.UseTextOptions = true;
            this.btnsua.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnsua.Image = Resources.Reso.imgedit;// (Image)manager.GetObject("btnsua.Image");
            this.btnsua.Location = new Point(310, 0x1c8);
            this.btnsua.Name = "btnsua";
            this.btnsua.Size = new Size(0x4b, 0x17);
            this.btnsua.TabIndex = 0x1d;
            this.btnsua.Text = " &Sửa [F3]";
            this.btnsua.Click += new EventHandler(this.btnsua_Click);
            this.btnhuy.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnhuy.Image = Resources.Reso.imgdelete;// (Image)manager.GetObject("btnhuy.Image");
            this.btnhuy.Location = new Point(0x1df, 0x1c8);
            this.btnhuy.Name = "btnhuy";
            this.btnhuy.Size = new Size(0x4b, 0x17);
            this.btnhuy.TabIndex = 0x1f;
            this.btnhuy.Text = " &Hủy [F7]";
            this.btnhuy.Click += new EventHandler(this.btnhuy_Click);
            this.btnketthuc.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
            this.btnketthuc.Appearance.Options.UseTextOptions = true;
            this.btnketthuc.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnketthuc.Image = Resources.Reso.imgclose;// (Image)manager.GetObject("btnketthuc.Image");
            this.btnketthuc.Location = new Point(0x397, 0x1c8);
            this.btnketthuc.Name = "btnketthuc";
            this.btnketthuc.Size = new Size(0x65, 0x17);
            this.btnketthuc.TabIndex = 0x23;
            this.btnketthuc.Text = " &Kết th\x00fac [F12]";
            this.btnketthuc.Click += new EventHandler(this.btnketthuc_Click);
            this.gridView1.Appearance.ColumnFilterButton.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.ColumnFilterButton.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.ColumnFilterButton.ForeColor = Color.Black;
            this.gridView1.Appearance.ColumnFilterButton.Options.UseBackColor = true;
            this.gridView1.Appearance.ColumnFilterButton.Options.UseBorderColor = true;
            this.gridView1.Appearance.ColumnFilterButton.Options.UseForeColor = true;
            this.gridView1.Appearance.ColumnFilterButtonActive.BackColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.ColumnFilterButtonActive.BorderColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.ColumnFilterButtonActive.ForeColor = Color.Black;
            this.gridView1.Appearance.ColumnFilterButtonActive.Options.UseBackColor = true;
            this.gridView1.Appearance.ColumnFilterButtonActive.Options.UseBorderColor = true;
            this.gridView1.Appearance.ColumnFilterButtonActive.Options.UseForeColor = true;
            this.gridView1.Appearance.Empty.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.Empty.BackColor2 = Color.White;
            this.gridView1.Appearance.Empty.Options.UseBackColor = true;
            this.gridView1.Appearance.EvenRow.BackColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.EvenRow.BorderColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView1.Appearance.EvenRow.ForeColor = Color.Black;
            this.gridView1.Appearance.EvenRow.Options.UseBackColor = true;
            this.gridView1.Appearance.EvenRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.EvenRow.Options.UseForeColor = true;
            this.gridView1.Appearance.FilterCloseButton.BackColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.FilterCloseButton.BorderColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.FilterCloseButton.ForeColor = Color.Black;
            this.gridView1.Appearance.FilterCloseButton.Options.UseBackColor = true;
            this.gridView1.Appearance.FilterCloseButton.Options.UseBorderColor = true;
            this.gridView1.Appearance.FilterCloseButton.Options.UseForeColor = true;
            this.gridView1.Appearance.FilterPanel.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.FilterPanel.BackColor2 = Color.White;
            this.gridView1.Appearance.FilterPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.FilterPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.FilterPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.FixedLine.BackColor = Color.FromArgb(0x7a, 0x72, 0x71);
            this.gridView1.Appearance.FixedLine.Options.UseBackColor = true;
            this.gridView1.Appearance.FocusedCell.BackColor = Color.White;
            this.gridView1.Appearance.FocusedCell.ForeColor = Color.Black;
            this.gridView1.Appearance.FocusedCell.Options.UseBackColor = true;
            this.gridView1.Appearance.FocusedCell.Options.UseForeColor = true;
            this.gridView1.Appearance.FocusedRow.BackColor = Color.FromArgb(200, 0xc0, 0x9d);
            this.gridView1.Appearance.FocusedRow.BorderColor = Color.FromArgb(0xe2, 0xdb, 0xbc);
            this.gridView1.Appearance.FocusedRow.ForeColor = Color.Black;
            this.gridView1.Appearance.FocusedRow.Options.UseBackColor = true;
            this.gridView1.Appearance.FocusedRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.FocusedRow.Options.UseForeColor = true;
            this.gridView1.Appearance.FooterPanel.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.FooterPanel.BorderColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.FooterPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.FooterPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.FooterPanel.Options.UseBorderColor = true;
            this.gridView1.Appearance.FooterPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.GroupButton.BackColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.GroupButton.BorderColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView1.Appearance.GroupButton.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupButton.Options.UseBorderColor = true;
            this.gridView1.Appearance.GroupFooter.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupFooter.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupFooter.ForeColor = Color.Black;
            this.gridView1.Appearance.GroupFooter.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupFooter.Options.UseBorderColor = true;
            this.gridView1.Appearance.GroupFooter.Options.UseForeColor = true;
            this.gridView1.Appearance.GroupPanel.BackColor = Color.FromArgb(0xf6, 0xf2, 0xd5);
            this.gridView1.Appearance.GroupPanel.BackColor2 = Color.White;
            this.gridView1.Appearance.GroupPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.GroupPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.GroupRow.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupRow.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.GroupRow.ForeColor = Color.Black;
            this.gridView1.Appearance.GroupRow.Options.UseBackColor = true;
            this.gridView1.Appearance.GroupRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.GroupRow.Options.UseForeColor = true;
            this.gridView1.Appearance.HeaderPanel.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.HeaderPanel.BorderColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.HeaderPanel.ForeColor = Color.Black;
            this.gridView1.Appearance.HeaderPanel.Options.UseBackColor = true;
            this.gridView1.Appearance.HeaderPanel.Options.UseBorderColor = true;
            this.gridView1.Appearance.HeaderPanel.Options.UseForeColor = true;
            this.gridView1.Appearance.HideSelectionRow.BackColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView1.Appearance.HideSelectionRow.BorderColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView1.Appearance.HideSelectionRow.ForeColor = Color.Black;
            this.gridView1.Appearance.HideSelectionRow.Options.UseBackColor = true;
            this.gridView1.Appearance.HideSelectionRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.HideSelectionRow.Options.UseForeColor = true;
            this.gridView1.Appearance.HorzLine.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.HorzLine.Options.UseBackColor = true;
            this.gridView1.Appearance.OddRow.BackColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView1.Appearance.OddRow.BorderColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView1.Appearance.OddRow.ForeColor = Color.Black;
            this.gridView1.Appearance.OddRow.Options.UseBackColor = true;
            this.gridView1.Appearance.OddRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.OddRow.Options.UseForeColor = true;
            this.gridView1.Appearance.Preview.BackColor = Color.FromArgb(0xfb, 0xfc, 0xf7);
            this.gridView1.Appearance.Preview.Font = new Font("Verdana", 7.5f);
            this.gridView1.Appearance.Preview.ForeColor = Color.FromArgb(0x94, 0x94, 0x94);
            this.gridView1.Appearance.Preview.Options.UseBackColor = true;
            this.gridView1.Appearance.Preview.Options.UseFont = true;
            this.gridView1.Appearance.Preview.Options.UseForeColor = true;
            this.gridView1.Appearance.Row.BackColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView1.Appearance.Row.ForeColor = Color.Black;
            this.gridView1.Appearance.Row.Options.UseBackColor = true;
            this.gridView1.Appearance.Row.Options.UseForeColor = true;
            this.gridView1.Appearance.RowSeparator.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView1.Appearance.RowSeparator.BackColor2 = Color.White;
            this.gridView1.Appearance.RowSeparator.Options.UseBackColor = true;
            this.gridView1.Appearance.SelectedRow.BackColor = Color.FromArgb(0xdd, 0xd7, 0xbc);
            this.gridView1.Appearance.SelectedRow.BorderColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView1.Appearance.SelectedRow.ForeColor = Color.Black;
            this.gridView1.Appearance.SelectedRow.Options.UseBackColor = true;
            this.gridView1.Appearance.SelectedRow.Options.UseBorderColor = true;
            this.gridView1.Appearance.SelectedRow.Options.UseForeColor = true;
            this.gridView1.Appearance.TopNewRow.BackColor = Color.White;
            this.gridView1.Appearance.TopNewRow.Options.UseBackColor = true;
            this.gridView1.Appearance.VertLine.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView1.Appearance.VertLine.Options.UseBackColor = true;
            this.gridView1.Columns.AddRange(new GridColumn[] { 
                this.gridds_ma, this.gridds_ten, this.gridds_dvt, this.gridds_id, this.gridds_dongia, this.gridds_soluong, this.gridds_thanhtien, this.gridds_idnhapct, this.gridds_slxuat, this.gridds_tenhoatchat, this.gridds_giaban, this.gridds_losx, this.gridds_handung, this.gridds_hangsx, this.gridds_idvitrikho, this.gridds_thue, 
                this.gridds_tongtien, this.gridds_tenvitrikho
             });
            condition.Appearance.ForeColor = Color.Red;
            condition.Appearance.Options.UseForeColor = true;
            condition.Column = this.gridds_dongia;
            condition.Condition = FormatConditionEnum.Between;
            condition.Value1 = "0";
            condition.Value2 = "0";
            this.gridView1.FormatConditions.AddRange(new StyleFormatCondition[] { condition });
            this.gridView1.GridControl = this.gridds;
            this.gridView1.Name = "gridView1";
            this.gridView1.OptionsBehavior.AllowAddRows = DefaultBoolean.True;
            this.gridView1.OptionsBehavior.AllowDeleteRows = DefaultBoolean.False;
            this.gridView1.OptionsBehavior.ReadOnly = true;
            this.gridView1.OptionsView.AutoCalcPreviewLineCount = true;
            this.gridView1.OptionsView.ColumnAutoWidth = false;
            this.gridView1.OptionsView.EnableAppearanceEvenRow = true;
            this.gridView1.OptionsView.EnableAppearanceOddRow = true;
            this.gridView1.OptionsView.ShowAutoFilterRow = true;
            this.gridView1.OptionsView.ShowFooter = true;
            this.gridView1.OptionsView.ShowGroupPanel = false;
            this.gridView1.RowCellStyle += new RowCellStyleEventHandler(this.gridView1_RowCellStyle);
            this.gridView1.CustomSummaryCalculate += new CustomSummaryEventHandler(this.gridView1_CustomSummaryCalculate);
            this.gridView1.FocusedRowChanged += new FocusedRowChangedEventHandler(this.gridView1_FocusedRowChanged);
            this.gridds_ma.Caption = "M\x00e3 số";
            this.gridds_ma.ColumnEdit = this.repositoryItemTextEdit1;
            this.gridds_ma.FieldName = "madp";
            this.gridds_ma.Name = "gridds_ma";
            this.gridds_ma.OptionsColumn.AllowEdit = false;
            this.gridds_ma.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(SummaryItemType.Count, "ma", "Cộng: {0:n0}") });
            this.gridds_ma.Visible = true;
            this.gridds_ma.VisibleIndex = 0;
            this.gridds_ma.Width = 0x3d;
            this.repositoryItemTextEdit1.AutoHeight = false;
            this.repositoryItemTextEdit1.Name = "repositoryItemTextEdit1";
            this.repositoryItemTextEdit1.ReadOnly = true;
            this.gridds_ten.Caption = "T\x00ean sản phẩm";
            this.gridds_ten.ColumnEdit = this.repositoryItemTextEdit1;
            this.gridds_ten.FieldName = "tendp";
            this.gridds_ten.Name = "gridds_ten";
            this.gridds_ten.OptionsColumn.AllowEdit = false;
            this.gridds_ten.Visible = true;
            this.gridds_ten.VisibleIndex = 1;
            this.gridds_ten.Width = 190;
            this.gridds_dvt.Caption = "ĐVT";
            this.gridds_dvt.ColumnEdit = this.repositoryItemTextEdit1;
            this.gridds_dvt.FieldName = "dvt";
            this.gridds_dvt.Name = "gridds_dvt";
            this.gridds_dvt.OptionsColumn.AllowEdit = false;
            this.gridds_dvt.Visible = true;
            this.gridds_dvt.VisibleIndex = 2;
            this.gridds_dvt.Width = 0x27;
            this.gridds_id.Caption = "id";
            this.gridds_id.FieldName = "iddp";
            this.gridds_id.Name = "gridds_id";
            this.gridds_soluong.Caption = "SL";
            this.gridds_soluong.ColumnEdit = this.repositoryItemTextEdit2;
            this.gridds_soluong.FieldName = "soluong";
            this.gridds_soluong.Name = "gridds_soluong";
            this.gridds_soluong.Visible = true;
            this.gridds_soluong.VisibleIndex = 4;
            this.gridds_soluong.Width = 0x25;
            this.gridds_thanhtien.Caption = "Số tiền";
            this.gridds_thanhtien.ColumnEdit = this.repositoryItemTextEdit2;
            this.gridds_thanhtien.FieldName = "thanhtien";
            this.gridds_thanhtien.Name = "gridds_thanhtien";
            this.gridds_thanhtien.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(SummaryItemType.Sum, "thanhtien", "Tổng: {0:n0}") });
            this.gridds_thanhtien.Visible = true;
            this.gridds_thanhtien.VisibleIndex = 5;
            this.gridds_thanhtien.Width = 100;
            this.gridds_idnhapct.Caption = "idnhapct";
            this.gridds_idnhapct.FieldName = "id";
            this.gridds_idnhapct.Name = "gridds_idnhapct";
            this.gridds_slxuat.Caption = "sldathanhtoan";
            this.gridds_slxuat.FieldName = "soluongxuat";
            this.gridds_slxuat.Name = "gridds_slxuat";
            this.gridds_tenhoatchat.Caption = "tenhoatchat";
            this.gridds_tenhoatchat.FieldName = "tenhoatchat";
            this.gridds_tenhoatchat.Name = "gridds_tenhoatchat";
            this.gridds_giaban.Caption = "giaban";
            this.gridds_giaban.FieldName = "giaban";
            this.gridds_giaban.Name = "gridds_giaban";
            this.gridds_losx.Caption = "L\x00f4 SX";
            this.gridds_losx.FieldName = "losx";
            this.gridds_losx.Name = "gridds_losx";
            this.gridds_losx.Visible = true;
            this.gridds_losx.VisibleIndex = 8;
            this.gridds_handung.Caption = "Date";
            this.gridds_handung.FieldName = "handung";
            this.gridds_handung.Name = "gridds_handung";
            this.gridds_handung.Visible = true;
            this.gridds_handung.VisibleIndex = 9;
            this.gridds_hangsx.Caption = "hangsx";
            this.gridds_hangsx.FieldName = "hangsx";
            this.gridds_hangsx.Name = "gridds_hangsx";
            this.gridds_idvitrikho.Caption = "idvitrikho";
            this.gridds_idvitrikho.FieldName = "idvitrikho";
            this.gridds_idvitrikho.Name = "gridds_idvitrikho";
            this.gridds_thue.Caption = "Thuế %";
            this.gridds_thue.FieldName = "thue";
            this.gridds_thue.Name = "gridds_thue";
            this.gridds_thue.Visible = true;
            this.gridds_thue.VisibleIndex = 6;
            this.gridds_thue.Width = 0x33;
            this.gridds_tenvitrikho.Caption = "Vị tr\x00ed trong kho";
            this.gridds_tenvitrikho.FieldName = "tenvitrikho";
            this.gridds_tenvitrikho.Name = "gridds_tenvitrikho";
            this.gridds_tenvitrikho.Visible = true;
            this.gridds_tenvitrikho.VisibleIndex = 10;
            this.gridds_tenvitrikho.Width = 0x107;
            this.gridds.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.gridds.Location = new Point(3, 130);
            this.gridds.MainView = this.gridView1;
            this.gridds.Name = "gridds";
            this.gridds.RepositoryItems.AddRange(new RepositoryItem[] { this.repositoryItemTextEdit1, this.repositoryItemTextEdit2 });
            this.gridds.Size = new Size(0x2f3, 0xe7);
            this.gridds.TabIndex = 0x20;
            this.gridds.ViewCollection.AddRange(new BaseView[] { this.gridView1 });
            this.btnboqua.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnboqua.Image = Resources.Reso.imgundo;// (Image)manager.GetObject("btnboqua.Image");
            this.btnboqua.Location = new Point(0x184, 0x1c8);
            this.btnboqua.Name = "btnboqua";
            this.btnboqua.Size = new Size(0x57, 0x17);
            this.btnboqua.TabIndex = 30;
            this.btnboqua.Text = " &Bỏ qua [F4]";
            this.btnboqua.Click += new EventHandler(this.btnboqua_Click);
            this.label1.Font = new Font("Tahoma", 10f);
            this.label1.Location = new Point(0x11, 0x33);
            this.label1.Name = "label1";
            this.label1.Size = new Size(0x5c, 0x13);
            this.label1.TabIndex = 2;
            this.label1.Text = "Số phiếu:";
            this.label1.TextAlign = ContentAlignment.TopRight;
            this.txtsophieu.Location = new Point(0x6a, 50);
            this.txtsophieu.Name = "txtsophieu";
            this.txtsophieu.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtsophieu.Properties.MaxLength = 10;
            this.txtsophieu.Size = new Size(0x60, 20);
            this.txtsophieu.TabIndex = 0;
            this.txtsophieu.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label6.Font = new Font("Tahoma", 10f);
            this.label6.Location = new Point(0xc7, 0x33);
            this.label6.Name = "label6";
            this.label6.Size = new Size(0x57, 0x13);
            this.label6.TabIndex = 2;
            this.label6.Text = "Họ v\x00e0 t\x00ean:";
            this.label6.TextAlign = ContentAlignment.TopRight;
            this.txthoten.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txthoten.Location = new Point(0x11c, 50);
            this.txthoten.Name = "txthoten";
            this.txthoten.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txthoten.Size = new Size(0x9c, 20);
            this.txthoten.TabIndex = 1;
            this.txthoten.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.ctrdanhsach_vp.ChieuRongTuDong = true;
            this.ctrdanhsach_vp.DanhSachCotHienThi = "";
            this.ctrdanhsach_vp.DanhSachCotHienThi_kt = "";
            this.ctrdanhsach_vp.Location = new Point(0x26d, 0x1b9);
            this.ctrdanhsach_vp.Name = "ctrdanhsach_vp";
            this.ctrdanhsach_vp.pRowsCountDown = 5;
            this.ctrdanhsach_vp.Size = new Size(60, 0x13);
            this.ctrdanhsach_vp.TabIndex = 14;
            this.ctrdanhsach_vp.Visible = false;
            this.ctrdanhsach_vp.Validated += new EventHandler(this.ctrdanhsach_vp_Validated);
            this.label10.Font = new Font("Tahoma", 10f);
            this.label10.Location = new Point(0, 0x4d);
            this.label10.Name = "label10";
            this.label10.Size = new Size(0x6d, 0x13);
            this.label10.TabIndex = 2;
            this.label10.Text = "Địa chỉ (ĐT)  LH:";
            this.label10.TextAlign = ContentAlignment.TopRight;
            this.tbnumdongia.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.tbnumdongia.BackColor = Color.White;
            this.tbnumdongia.DecimalBalance = 0;
            this.tbnumdongia.Enabled = false;
            this.tbnumdongia.Location = new Point(0x11c, 0x189);
            this.tbnumdongia.Name = "tbnumdongia";
            this.tbnumdongia.ReadOnly = false;
            this.tbnumdongia.Size = new Size(0x57, 0x16);
            this.tbnumdongia.SymbolDecimal = ",";
            this.tbnumdongia.SymbolThousand = ".";
            this.tbnumdongia.TabIndex = 0x11;
            this.tbnumdongia.Texts = "0";
            int[] bits = new int[4];
            this.tbnumdongia.Values = new decimal(bits);
            this.tbnumdongia.Validated += new EventHandler(this.tbnumsoluong_Validated);
            this.txttenhoatchat.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom;
            this.txttenhoatchat.Location = new Point(0x342, 0x16f);
            this.txttenhoatchat.Name = "txttenhoatchat";
            this.txttenhoatchat.Size = new Size(0xb6, 20);
            this.txttenhoatchat.TabIndex = 15;
            this.txttenhoatchat.TextChanged += new EventHandler(this.txtten_TextChanged);
            this.txttenhoatchat.Enter += new EventHandler(this.txtten_Enter);
            this.txttenhoatchat.KeyDown += new KeyEventHandler(this.txtten_KeyDown);
            this.txttenhoatchat.Validated += new EventHandler(this.txtten_Validated);
            this.label2.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label2.Font = new Font("Tahoma", 10f);
            this.label2.Location = new Point(0x2cd, 0x170);
            this.label2.Name = "label2";
            this.label2.Size = new Size(0x79, 0x13);
            this.label2.TabIndex = 2;
            this.label2.Text = "Hoạt chất:";
            this.label2.TextAlign = ContentAlignment.TopRight;
            this.label14.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label14.Font = new Font("Tahoma", 10f);
            this.label14.Location = new Point(7, 0x18a);
            this.label14.Name = "label14";
            this.label14.Size = new Size(0x5d, 0x13);
            this.label14.TabIndex = 2;
            this.label14.Text = "Số lượng:";
            this.label14.TextAlign = ContentAlignment.TopRight;
            this.label15.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label15.Font = new Font("Tahoma", 10f);
            this.label15.Location = new Point(0xd4, 0x18a);
            this.label15.Name = "label15";
            this.label15.Size = new Size(0x49, 0x13);
            this.label15.TabIndex = 2;
            this.label15.Text = "Đơn gi\x00e1:";
            this.label15.TextAlign = ContentAlignment.TopRight;
            this.label16.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label16.Font = new Font("Tahoma", 10f);
            this.label16.Location = new Point(0x16c, 420);
            this.label16.Name = "label16";
            this.label16.Size = new Size(0x4c, 0x13);
            this.label16.TabIndex = 2;
            this.label16.Text = "H\x00e3ng SX:";
            this.label16.TextAlign = ContentAlignment.TopRight;
            this.txthangsx.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.txthangsx.EditValue = "";
            this.txthangsx.Location = new Point(0x1bb, 0x1a3);
            this.txthangsx.Name = "txthangsx";
            this.txthangsx.Properties.ReadOnly = true;
            this.txthangsx.Size = new Size(160, 20);
            this.txthangsx.TabIndex = 0x18;
            this.txthangsx.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.tbnumsoluong.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.tbnumsoluong.BackColor = Color.White;
            this.tbnumsoluong.DecimalBalance = 0;
            this.tbnumsoluong.Location = new Point(0x60, 0x189);
            this.tbnumsoluong.Name = "tbnumsoluong";
            this.tbnumsoluong.ReadOnly = false;
            this.tbnumsoluong.Size = new Size(0x40, 0x16);
            this.tbnumsoluong.SymbolDecimal = ",";
            this.tbnumsoluong.SymbolThousand = ".";
            this.tbnumsoluong.TabIndex = 0x10;
            this.tbnumsoluong.Texts = "0";
            bits = new int[4];
            this.tbnumsoluong.Values = new decimal(bits);
            this.tbnumsoluong.Validated += new EventHandler(this.tbnumsoluong_Validated);
            this.label8.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label8.Font = new Font("Tahoma", 10f);
            this.label8.Location = new Point(0x31c, 0x31);
            this.label8.Name = "label8";
            this.label8.Size = new Size(0x36, 0x13);
            this.label8.TabIndex = 2;
            this.label8.Text = "Ng\x00e0y:";
            this.label8.TextAlign = ContentAlignment.TopRight;
            this.datengay.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.datengay.EditValue = new DateTime(0x7dd, 11, 8, 2, 0x16, 9, 0x297);
            this.datengay.Location = new Point(850, 50);
            this.datengay.Name = "datengay";
            this.datengay.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.datengay.Properties.DisplayFormat.FormatString = "dd/MM/yyyy HH:mm";
            this.datengay.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.datengay.Properties.EditFormat.FormatString = "dd/MM/yyyy HH:mm";
            this.datengay.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.datengay.Properties.Mask.EditMask = "dd/MM/yyyy HH:mm";
            this.datengay.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.datengay.Size = new Size(0xab, 20);
            this.datengay.TabIndex = 5;
            this.datengay.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label17.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label17.Font = new Font("Tahoma", 10f);
            this.label17.Location = new Point(0x1b3, 0x33);
            this.label17.Name = "label17";
            this.label17.Size = new Size(0x4c, 0x13);
            this.label17.TabIndex = 2;
            this.label17.Text = "Giới t\x00ednh:";
            this.label17.TextAlign = ContentAlignment.TopRight;
            this.label18.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label18.Font = new Font("Tahoma", 10f);
            this.label18.Location = new Point(0x24a, 0x35);
            this.label18.Name = "label18";
            this.label18.Size = new Size(0x34, 0x13);
            this.label18.TabIndex = 2;
            this.label18.Text = "Tuổi:";
            this.label18.TextAlign = ContentAlignment.TopRight;
            this.txtdiachi.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtdiachi.Location = new Point(0x6a, 0x4c);
            this.txtdiachi.Name = "txtdiachi";
            this.txtdiachi.Properties.CharacterCasing = CharacterCasing.Upper;
            this.txtdiachi.Size = new Size(0x1cd, 20);
            this.txtdiachi.TabIndex = 6;
            this.txtdiachi.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label19.Font = new Font("Tahoma", 10f);
            this.label19.Location = new Point(0x21, 0x68);
            this.label19.Name = "label19";
            this.label19.Size = new Size(0x4b, 0x13);
            this.label19.TabIndex = 2;
            this.label19.Text = "Tổng tiền:";
            this.label19.TextAlign = ContentAlignment.TopRight;
            this.tbnumtongtien.BackColor = Color.White;
            this.tbnumtongtien.DecimalBalance = 0;
            this.tbnumtongtien.Enabled = false;
            this.tbnumtongtien.Font = new Font("Tahoma", 12f);
            this.tbnumtongtien.Location = new Point(0x6a, 0x66);
            this.tbnumtongtien.Margin = new Padding(4, 4, 4, 4);
            this.tbnumtongtien.Name = "tbnumtongtien";
            this.tbnumtongtien.ReadOnly = true;
            this.tbnumtongtien.Size = new Size(0x60, 0x16);
            this.tbnumtongtien.SymbolDecimal = ",";
            this.tbnumtongtien.SymbolThousand = ".";
            this.tbnumtongtien.TabIndex = 8;
            this.tbnumtongtien.Texts = "0";
            bits = new int[4];
            this.tbnumtongtien.Values = new decimal(bits);
            this.label20.Font = new Font("Tahoma", 10f);
            this.label20.Location = new Point(0x1b6, 0x68);
            this.label20.Name = "label20";
            this.label20.Size = new Size(0x49, 0x13);
            this.label20.TabIndex = 2;
            this.label20.Text = "Thực thu:";
            this.label20.TextAlign = ContentAlignment.TopRight;
            this.tbnumtongthucthu.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.tbnumtongthucthu.BackColor = Color.White;
            this.tbnumtongthucthu.DecimalBalance = 0;
            this.tbnumtongthucthu.Enabled = false;
            this.tbnumtongthucthu.Font = new Font("Tahoma", 12f);
            this.tbnumtongthucthu.Location = new Point(0x1fa, 0x65);
            this.tbnumtongthucthu.Margin = new Padding(4, 4, 4, 4);
            this.tbnumtongthucthu.Name = "tbnumtongthucthu";
            this.tbnumtongthucthu.ReadOnly = false;
            this.tbnumtongthucthu.Size = new Size(0xfc, 0x16);
            this.tbnumtongthucthu.SymbolDecimal = ",";
            this.tbnumtongthucthu.SymbolThousand = ".";
            this.tbnumtongthucthu.TabIndex = 11;
            this.tbnumtongthucthu.Texts = "0";
            bits = new int[4];
            this.tbnumtongthucthu.Values = new decimal(bits);
            this.label4.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label4.Font = new Font("Tahoma", 10f);
            this.label4.Location = new Point(0x17d, 0x189);
            this.label4.Name = "label4";
            this.label4.Size = new Size(0x3e, 0x13);
            this.label4.TabIndex = 2;
            this.label4.Text = "Số tiền:";
            this.label4.TextAlign = ContentAlignment.TopRight;
            this.tbnumsotien.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.tbnumsotien.BackColor = Color.White;
            this.tbnumsotien.DecimalBalance = 0;
            this.tbnumsotien.Enabled = false;
            this.tbnumsotien.Location = new Point(0x1bb, 0x188);
            this.tbnumsotien.Name = "tbnumsotien";
            this.tbnumsotien.ReadOnly = false;
            this.tbnumsotien.Size = new Size(0x4e, 0x15);
            this.tbnumsotien.SymbolDecimal = ",";
            this.tbnumsotien.SymbolThousand = ".";
            this.tbnumsotien.TabIndex = 0x12;
            this.tbnumsotien.Texts = "0";
            bits = new int[4];
            this.tbnumsotien.Values = new decimal(bits);
            this.label5.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label5.Font = new Font("Tahoma", 10f);
            this.label5.Location = new Point(0x207, 0x189);
            this.label5.Name = "label5";
            this.label5.Size = new Size(0x33, 0x13);
            this.label5.TabIndex = 2;
            this.label5.Text = "Thuế:";
            this.label5.TextAlign = ContentAlignment.TopRight;
            this.numthue.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.numthue.Location = new Point(570, 0x188);
            this.numthue.Name = "numthue";
            this.numthue.Size = new Size(0x21, 0x15);
            this.numthue.TabIndex = 0x13;
            this.numthue.Enter += new EventHandler(this.numthue_Enter);
            this.numthue.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.numthue.Validated += new EventHandler(this.tbnumsoluong_Validated);
            this.label7.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label7.Font = new Font("Tahoma", 10f);
            this.label7.Location = new Point(0x259, 0x188);
            this.label7.Name = "label7";
            this.label7.Size = new Size(0x18, 0x13);
            this.label7.TabIndex = 2;
            this.label7.Text = "%";
            this.label7.TextAlign = ContentAlignment.TopRight;
            this.label12.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label12.Font = new Font("Tahoma", 10f);
            this.label12.Location = new Point(0x265, 0x189);
            this.label12.Name = "label12";
            this.label12.Size = new Size(0x54, 0x13);
            this.label12.TabIndex = 2;
            this.label12.Text = "Tiền thuế:";
            this.label12.TextAlign = ContentAlignment.TopRight;
            this.tbnumtienthue.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.tbnumtienthue.BackColor = Color.White;
            this.tbnumtienthue.DecimalBalance = 0;
            this.tbnumtienthue.Enabled = false;
            this.tbnumtienthue.Location = new Point(0x2b4, 0x189);
            this.tbnumtienthue.Name = "tbnumtienthue";
            this.tbnumtienthue.ReadOnly = false;
            this.tbnumtienthue.Size = new Size(0x44, 0x16);
            this.tbnumtienthue.SymbolDecimal = ",";
            this.tbnumtienthue.SymbolThousand = ".";
            this.tbnumtienthue.TabIndex = 20;
            this.tbnumtienthue.Texts = "0";
            bits = new int[4];
            this.tbnumtienthue.Values = new decimal(bits);
            this.label13.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label13.Font = new Font("Tahoma", 10f);
            this.label13.Location = new Point(0x2f4, 0x189);
            this.label13.Name = "label13";
            this.label13.Size = new Size(0x52, 0x13);
            this.label13.TabIndex = 2;
            this.label13.Text = "Th\x00e0nh tiền:";
            this.label13.TextAlign = ContentAlignment.TopRight;
            this.tbnumthanhtien.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom;
            this.tbnumthanhtien.BackColor = Color.White;
            this.tbnumthanhtien.DecimalBalance = 0;
            this.tbnumthanhtien.Location = new Point(0x342, 0x189);
            this.tbnumthanhtien.Name = "tbnumthanhtien";
            this.tbnumthanhtien.ReadOnly = false;
            this.tbnumthanhtien.Size = new Size(0xb6, 0x16);
            this.tbnumthanhtien.SymbolDecimal = ",";
            this.tbnumthanhtien.SymbolThousand = ".";
            this.tbnumthanhtien.TabIndex = 0x15;
            this.tbnumthanhtien.Texts = "0";
            bits = new int[4];
            this.tbnumthanhtien.Values = new decimal(bits);
            this.label21.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label21.Font = new Font("Tahoma", 10f);
            this.label21.Location = new Point(20, 420);
            this.label21.Name = "label21";
            this.label21.Size = new Size(80, 0x13);
            this.label21.TabIndex = 2;
            this.label21.Text = "L\x00f4 SX:";
            this.label21.TextAlign = ContentAlignment.TopRight;
            this.txtlosx.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.txtlosx.EditValue = "";
            this.txtlosx.Location = new Point(0x60, 420);
            this.txtlosx.Name = "txtlosx";
            this.txtlosx.Properties.ReadOnly = true;
            this.txtlosx.Size = new Size(0x6a, 20);
            this.txtlosx.TabIndex = 0x16;
            this.txtlosx.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label22.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label22.Font = new Font("Tahoma", 10f);
            this.label22.Location = new Point(0xd4, 420);
            this.label22.Name = "label22";
            this.label22.Size = new Size(0x49, 0x13);
            this.label22.TabIndex = 2;
            this.label22.Text = "Hạn d\x00f9ng:";
            this.label22.TextAlign = ContentAlignment.TopRight;
            this.datehandung.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.datehandung.EditValue = new DateTime(0x7dd, 11, 8, 2, 0x16, 9, 0x297);
            this.datehandung.Location = new Point(0x11c, 0x1a3);
            this.datehandung.Name = "datehandung";
            this.datehandung.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.datehandung.Properties.DisplayFormat.FormatString = "dd/MM/yyyy";
            this.datehandung.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.datehandung.Properties.EditFormat.FormatString = "dd/MM/yyyy";
            this.datehandung.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.datehandung.Properties.Mask.EditMask = "dd/MM/yyyy";
            this.datehandung.Properties.ReadOnly = true;
            this.datehandung.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.datehandung.Size = new Size(0x57, 20);
            this.datehandung.TabIndex = 0x17;
            this.datehandung.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label23.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.label23.Font = new Font("Tahoma", 10f);
            this.label23.Location = new Point(0x26a, 420);
            this.label23.Name = "label23";
            this.label23.Size = new Size(0x4c, 0x13);
            this.label23.TabIndex = 2;
            this.label23.Text = "Vị tr\x00ed kho:";
            this.label23.TextAlign = ContentAlignment.TopRight;
            this.txtvitrikhoten.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom;
            this.txtvitrikhoten.EditValue = "";
            this.txtvitrikhoten.Location = new Point(0x2b4, 420);
            this.txtvitrikhoten.Name = "txtvitrikhoten";
            this.txtvitrikhoten.Properties.ReadOnly = true;
            this.txtvitrikhoten.Size = new Size(0x144, 20);
            this.txtvitrikhoten.TabIndex = 0x19;
            this.txtvitrikhoten.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.btnmoi.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnmoi.Appearance.Options.UseTextOptions = true;
            this.btnmoi.Appearance.TextOptions.HAlignment = HorzAlignment.Near;
            this.btnmoi.Image = (Image) manager.GetObject("btnmoi.Image");
            this.btnmoi.Location = new Point(9, 0x1c8);
            this.btnmoi.Name = "btnmoi";
            this.btnmoi.Size = new Size(0x4b, 0x17);
            this.btnmoi.TabIndex = 0x1c;
            this.btnmoi.Text = " &Mới";
            this.btnmoi.Click += new EventHandler(this.btnmoi_Click_1);
            this.btnxoa.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnxoa.Image = (Image) manager.GetObject("btnxoa.Image");
            this.btnxoa.Location = new Point(0xa2, 0x1c8);
            this.btnxoa.Name = "btnxoa";
            this.btnxoa.Size = new Size(0x42, 0x17);
            this.btnxoa.TabIndex = 0x21;
            this.btnxoa.Text = " &X\x00f3a";
            this.btnxoa.Click += new EventHandler(this.btnxoa_Click);
            this.label25.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.label25.BackColor = Color.Green;
            this.label25.Font = new Font("Tahoma", 16f);
            this.label25.ForeColor = Color.White;
            this.label25.Location = new Point(0, 0);
            this.label25.Name = "label25";
            this.label25.Size = new Size(0x401, 0x2c);
            this.label25.TabIndex = 2;
            this.label25.Text = "XUẤT B\x00c1N LẺ";
            this.label25.TextAlign = ContentAlignment.MiddleLeft;
            this.cbbgioitinh.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.cbbgioitinh.Location = new Point(0x1fa, 50);
            this.cbbgioitinh.Name = "cbbgioitinh";
            this.cbbgioitinh.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.cbbgioitinh.Properties.Columns.AddRange(new LookUpColumnInfo[] { new LookUpColumnInfo("id", "id"), new LookUpColumnInfo("ten", "T\x00ean ph\x00f2ng") });
            this.cbbgioitinh.Size = new Size(0x3d, 20);
            this.cbbgioitinh.TabIndex = 2;
            this.cbbgioitinh.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.tbnumtuoi.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.tbnumtuoi.BackColor = Color.White;
            this.tbnumtuoi.DecimalBalance = 0;
            this.tbnumtuoi.Location = new Point(0x27b, 50);
            this.tbnumtuoi.Name = "tbnumtuoi";
            this.tbnumtuoi.ReadOnly = false;
            this.tbnumtuoi.Size = new Size(0x1f, 20);
            this.tbnumtuoi.SymbolDecimal = ",";
            this.tbnumtuoi.SymbolThousand = ".";
            this.tbnumtuoi.TabIndex = 3;
            this.tbnumtuoi.Texts = "0";
            bits = new int[4];
            this.tbnumtuoi.Values = new decimal(bits);
            this.tbnumtuoi.Validated += new EventHandler(this.tbnumtuoi_Validated);
            this.label26.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label26.Font = new Font("Tahoma", 10f);
            this.label26.Location = new Point(0x295, 50);
            this.label26.Name = "label26";
            this.label26.Size = new Size(0x4d, 0x13);
            this.label26.TabIndex = 2;
            this.label26.Text = "Năm sinh:";
            this.label26.TextAlign = ContentAlignment.TopRight;
            this.numnamsinh.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.numnamsinh.Location = new Point(740, 0x31);
            bits = new int[4];
            bits[0] = 0x1869f;
            this.numnamsinh.Maximum = new decimal(bits);
            this.numnamsinh.Name = "numnamsinh";
            this.numnamsinh.Size = new Size(50, 0x15);
            this.numnamsinh.TabIndex = 4;
            this.numnamsinh.Enter += new EventHandler(this.numthue_Enter);
            this.numnamsinh.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.numnamsinh.Validated += new EventHandler(this.numnamsinh_Validated);
            this.tbnumtongmiengiam.BackColor = Color.White;
            this.tbnumtongmiengiam.DecimalBalance = 0;
            this.tbnumtongmiengiam.Font = new Font("Tahoma", 12f);
            this.tbnumtongmiengiam.Location = new Point(0x162, 0x66);
            this.tbnumtongmiengiam.Margin = new Padding(4, 4, 4, 4);
            this.tbnumtongmiengiam.Name = "tbnumtongmiengiam";
            this.tbnumtongmiengiam.ReadOnly = false;
            this.tbnumtongmiengiam.Size = new Size(0x56, 0x16);
            this.tbnumtongmiengiam.SymbolDecimal = ",";
            this.tbnumtongmiengiam.SymbolThousand = ".";
            this.tbnumtongmiengiam.TabIndex = 10;
            this.tbnumtongmiengiam.Texts = "0";
            bits = new int[4];
            this.tbnumtongmiengiam.Values = new decimal(bits);
            this.label9.Font = new Font("Tahoma", 10f);
            this.label9.Location = new Point(0xca, 0x68);
            this.label9.Name = "label9";
            this.label9.Size = new Size(0x54, 0x13);
            this.label9.TabIndex = 2;
            this.label9.Text = "Chiết khấu:";
            this.label9.TextAlign = ContentAlignment.TopRight;
            this.label3.Font = new Font("Tahoma", 10f);
            this.label3.Location = new Point(0x13b, 0x69);
            this.label3.Name = "label3";
            this.label3.Size = new Size(0x18, 0x13);
            this.label3.TabIndex = 2;
            this.label3.Text = "%";
            this.label3.TextAlign = ContentAlignment.TopRight;
            this.nummiengiam.Font = new Font("Tahoma", 10f);
            this.nummiengiam.Location = new Point(0x11c, 0x66);
            this.nummiengiam.Name = "nummiengiam";
            this.nummiengiam.Size = new Size(0x21, 0x18);
            this.nummiengiam.TabIndex = 9;
            this.nummiengiam.Enter += new EventHandler(this.numthue_Enter);
            this.nummiengiam.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.nummiengiam.Validated += new EventHandler(this.nummiengiam_Validated);
            this.label24.Font = new Font("Tahoma", 10f, FontStyle.Bold);
            this.label24.Location = new Point(0x14f, 0x69);
            this.label24.Name = "label24";
            this.label24.Size = new Size(0x13, 0x13);
            this.label24.TabIndex = 2;
            this.label24.Text = "=";
            this.label24.TextAlign = ContentAlignment.TopRight;
            this.groupControl1.Anchor = AnchorStyles.Right | AnchorStyles.Bottom | AnchorStyles.Top;
            this.groupControl1.Appearance.Font = new Font("Tahoma", 10f);
            this.groupControl1.Appearance.Options.UseFont = true;
            this.groupControl1.AppearanceCaption.Font = new Font("Tahoma", 10f, FontStyle.Bold);
            this.groupControl1.AppearanceCaption.Options.UseFont = true;
            this.groupControl1.Controls.Add(this.datetungay);
            this.groupControl1.Controls.Add(this.datedenngay);
            this.groupControl1.Controls.Add(this.label27);
            this.groupControl1.Controls.Add(this.label11);
            this.groupControl1.Controls.Add(this.btntim);
            this.groupControl1.Controls.Add(this.gridsp);
            this.groupControl1.Location = new Point(0x2fc, 0x4d);
            this.groupControl1.Name = "groupControl1";
            this.groupControl1.Size = new Size(0x100, 0x11c);
            this.groupControl1.TabIndex = 0x22;
            this.groupControl1.Text = "Phiếu đ\x00e3 xuất";
            this.datetungay.EditValue = new DateTime(0x7dd, 11, 8, 2, 0x16, 9, 0x297);
            this.datetungay.Location = new Point(0x21, 30);
            this.datetungay.Name = "datetungay";
            this.datetungay.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.datetungay.Properties.DisplayFormat.FormatString = "dd/MM/yyyy";
            this.datetungay.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.datetungay.Properties.EditFormat.FormatString = "dd/MM/yyyy";
            this.datetungay.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.datetungay.Properties.Mask.EditMask = "dd/MM/yyyy";
            this.datetungay.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.datetungay.Size = new Size(80, 20);
            this.datetungay.TabIndex = 0x16;
            this.datetungay.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.datedenngay.EditValue = new DateTime(0x7dd, 11, 8, 2, 0x16, 9, 0x297);
            this.datedenngay.Location = new Point(0x91, 30);
            this.datedenngay.Name = "datedenngay";
            this.datedenngay.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.datedenngay.Properties.DisplayFormat.FormatString = "dd/MM/yyyy";
            this.datedenngay.Properties.DisplayFormat.FormatType = FormatType.DateTime;
            this.datedenngay.Properties.EditFormat.FormatString = "dd/MM/yyyy";
            this.datedenngay.Properties.EditFormat.FormatType = FormatType.DateTime;
            this.datedenngay.Properties.Mask.EditMask = "dd/MM/yyyy";
            this.datedenngay.Properties.VistaTimeProperties.Buttons.AddRange(new EditorButton[] { new EditorButton() });
            this.datedenngay.Size = new Size(80, 20);
            this.datedenngay.TabIndex = 0x16;
            this.datedenngay.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.label27.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label27.Font = new Font("Tahoma", 10f);
            this.label27.Location = new Point(110, 30);
            this.label27.Name = "label27";
            this.label27.Size = new Size(0x23, 0x13);
            this.label27.TabIndex = 2;
            this.label27.Text = "đến:";
            this.label27.TextAlign = ContentAlignment.TopRight;
            this.label11.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label11.Font = new Font("Tahoma", 10f);
            this.label11.Location = new Point(3, 30);
            this.label11.Name = "label11";
            this.label11.Size = new Size(30, 0x13);
            this.label11.TabIndex = 2;
            this.label11.Text = "Từ:";
            this.label11.TextAlign = ContentAlignment.TopRight;
            this.btntim.Image = (Image) manager.GetObject("btntim.Image");
            this.btntim.Location = new Point(0xe3, 30);
            this.btntim.Name = "btntim";
            this.btntim.Size = new Size(0x1a, 20);
            this.btntim.TabIndex = 30;
            this.btntim.Click += new EventHandler(this.btntim_Click);
            this.gridsp.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
            this.gridsp.Location = new Point(4, 0x38);
            this.gridsp.MainView = this.gridView2;
            this.gridsp.Name = "gridsp";
            this.gridsp.RepositoryItems.AddRange(new RepositoryItem[] { this.repositoryItemTextEdit3, this.repositoryItemTextEdit4 });
            this.gridsp.Size = new Size(0xf9, 0xe4);
            this.gridsp.TabIndex = 0;
            this.gridsp.ViewCollection.AddRange(new BaseView[] { this.gridView2 });
            this.gridView2.Appearance.ColumnFilterButton.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.ColumnFilterButton.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.ColumnFilterButton.ForeColor = Color.Black;
            this.gridView2.Appearance.ColumnFilterButton.Options.UseBackColor = true;
            this.gridView2.Appearance.ColumnFilterButton.Options.UseBorderColor = true;
            this.gridView2.Appearance.ColumnFilterButton.Options.UseForeColor = true;
            this.gridView2.Appearance.ColumnFilterButtonActive.BackColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView2.Appearance.ColumnFilterButtonActive.BorderColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView2.Appearance.ColumnFilterButtonActive.ForeColor = Color.Black;
            this.gridView2.Appearance.ColumnFilterButtonActive.Options.UseBackColor = true;
            this.gridView2.Appearance.ColumnFilterButtonActive.Options.UseBorderColor = true;
            this.gridView2.Appearance.ColumnFilterButtonActive.Options.UseForeColor = true;
            this.gridView2.Appearance.Empty.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.Empty.BackColor2 = Color.White;
            this.gridView2.Appearance.Empty.Options.UseBackColor = true;
            this.gridView2.Appearance.EvenRow.BackColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView2.Appearance.EvenRow.BorderColor = Color.FromArgb(0xdd, 0xe7, 0xea);
            this.gridView2.Appearance.EvenRow.ForeColor = Color.Black;
            this.gridView2.Appearance.EvenRow.Options.UseBackColor = true;
            this.gridView2.Appearance.EvenRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.EvenRow.Options.UseForeColor = true;
            this.gridView2.Appearance.FilterCloseButton.BackColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView2.Appearance.FilterCloseButton.BorderColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView2.Appearance.FilterCloseButton.ForeColor = Color.Black;
            this.gridView2.Appearance.FilterCloseButton.Options.UseBackColor = true;
            this.gridView2.Appearance.FilterCloseButton.Options.UseBorderColor = true;
            this.gridView2.Appearance.FilterCloseButton.Options.UseForeColor = true;
            this.gridView2.Appearance.FilterPanel.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.FilterPanel.BackColor2 = Color.White;
            this.gridView2.Appearance.FilterPanel.ForeColor = Color.Black;
            this.gridView2.Appearance.FilterPanel.Options.UseBackColor = true;
            this.gridView2.Appearance.FilterPanel.Options.UseForeColor = true;
            this.gridView2.Appearance.FixedLine.BackColor = Color.FromArgb(0x7a, 0x72, 0x71);
            this.gridView2.Appearance.FixedLine.Options.UseBackColor = true;
            this.gridView2.Appearance.FocusedCell.BackColor = Color.White;
            this.gridView2.Appearance.FocusedCell.ForeColor = Color.Black;
            this.gridView2.Appearance.FocusedCell.Options.UseBackColor = true;
            this.gridView2.Appearance.FocusedCell.Options.UseForeColor = true;
            this.gridView2.Appearance.FocusedRow.BackColor = Color.FromArgb(200, 0xc0, 0x9d);
            this.gridView2.Appearance.FocusedRow.BorderColor = Color.FromArgb(0xe2, 0xdb, 0xbc);
            this.gridView2.Appearance.FocusedRow.ForeColor = Color.Black;
            this.gridView2.Appearance.FocusedRow.Options.UseBackColor = true;
            this.gridView2.Appearance.FocusedRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.FocusedRow.Options.UseForeColor = true;
            this.gridView2.Appearance.FooterPanel.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.FooterPanel.BorderColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.FooterPanel.ForeColor = Color.Black;
            this.gridView2.Appearance.FooterPanel.Options.UseBackColor = true;
            this.gridView2.Appearance.FooterPanel.Options.UseBorderColor = true;
            this.gridView2.Appearance.FooterPanel.Options.UseForeColor = true;
            this.gridView2.Appearance.GroupButton.BackColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView2.Appearance.GroupButton.BorderColor = Color.FromArgb(0xd8, 0xd1, 0xb3);
            this.gridView2.Appearance.GroupButton.Options.UseBackColor = true;
            this.gridView2.Appearance.GroupButton.Options.UseBorderColor = true;
            this.gridView2.Appearance.GroupFooter.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.GroupFooter.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.GroupFooter.ForeColor = Color.Black;
            this.gridView2.Appearance.GroupFooter.Options.UseBackColor = true;
            this.gridView2.Appearance.GroupFooter.Options.UseBorderColor = true;
            this.gridView2.Appearance.GroupFooter.Options.UseForeColor = true;
            this.gridView2.Appearance.GroupPanel.BackColor = Color.FromArgb(0xf6, 0xf2, 0xd5);
            this.gridView2.Appearance.GroupPanel.BackColor2 = Color.White;
            this.gridView2.Appearance.GroupPanel.ForeColor = Color.Black;
            this.gridView2.Appearance.GroupPanel.Options.UseBackColor = true;
            this.gridView2.Appearance.GroupPanel.Options.UseForeColor = true;
            this.gridView2.Appearance.GroupRow.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.GroupRow.BorderColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.GroupRow.ForeColor = Color.Black;
            this.gridView2.Appearance.GroupRow.Options.UseBackColor = true;
            this.gridView2.Appearance.GroupRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.GroupRow.Options.UseForeColor = true;
            this.gridView2.Appearance.HeaderPanel.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.HeaderPanel.BorderColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.HeaderPanel.ForeColor = Color.Black;
            this.gridView2.Appearance.HeaderPanel.Options.UseBackColor = true;
            this.gridView2.Appearance.HeaderPanel.Options.UseBorderColor = true;
            this.gridView2.Appearance.HeaderPanel.Options.UseForeColor = true;
            this.gridView2.Appearance.HideSelectionRow.BackColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView2.Appearance.HideSelectionRow.BorderColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView2.Appearance.HideSelectionRow.ForeColor = Color.Black;
            this.gridView2.Appearance.HideSelectionRow.Options.UseBackColor = true;
            this.gridView2.Appearance.HideSelectionRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.HideSelectionRow.Options.UseForeColor = true;
            this.gridView2.Appearance.HorzLine.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.HorzLine.Options.UseBackColor = true;
            this.gridView2.Appearance.OddRow.BackColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView2.Appearance.OddRow.BorderColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView2.Appearance.OddRow.ForeColor = Color.Black;
            this.gridView2.Appearance.OddRow.Options.UseBackColor = true;
            this.gridView2.Appearance.OddRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.OddRow.Options.UseForeColor = true;
            this.gridView2.Appearance.Preview.BackColor = Color.FromArgb(0xfb, 0xfc, 0xf7);
            this.gridView2.Appearance.Preview.Font = new Font("Verdana", 7.5f);
            this.gridView2.Appearance.Preview.ForeColor = Color.FromArgb(0x94, 0x94, 0x94);
            this.gridView2.Appearance.Preview.Options.UseBackColor = true;
            this.gridView2.Appearance.Preview.Options.UseFont = true;
            this.gridView2.Appearance.Preview.Options.UseForeColor = true;
            this.gridView2.Appearance.Row.BackColor = Color.FromArgb(0xf2, 0xf4, 0xec);
            this.gridView2.Appearance.Row.ForeColor = Color.Black;
            this.gridView2.Appearance.Row.Options.UseBackColor = true;
            this.gridView2.Appearance.Row.Options.UseForeColor = true;
            this.gridView2.Appearance.RowSeparator.BackColor = Color.FromArgb(0xec, 0xe8, 0xc9);
            this.gridView2.Appearance.RowSeparator.BackColor2 = Color.White;
            this.gridView2.Appearance.RowSeparator.Options.UseBackColor = true;
            this.gridView2.Appearance.SelectedRow.BackColor = Color.FromArgb(0xdd, 0xd7, 0xbc);
            this.gridView2.Appearance.SelectedRow.BorderColor = Color.FromArgb(0xed, 230, 0xcb);
            this.gridView2.Appearance.SelectedRow.ForeColor = Color.Black;
            this.gridView2.Appearance.SelectedRow.Options.UseBackColor = true;
            this.gridView2.Appearance.SelectedRow.Options.UseBorderColor = true;
            this.gridView2.Appearance.SelectedRow.Options.UseForeColor = true;
            this.gridView2.Appearance.TopNewRow.BackColor = Color.White;
            this.gridView2.Appearance.TopNewRow.Options.UseBackColor = true;
            this.gridView2.Appearance.VertLine.BackColor = Color.FromArgb(0xd8, 0xd1, 170);
            this.gridView2.Appearance.VertLine.Options.UseBackColor = true;
            this.gridView2.Columns.AddRange(new GridColumn[] { this.gridsp_id, this.gridsp_ngay, this.gridsp_sophieu });
            condition2.Appearance.ForeColor = Color.Red;
            condition2.Appearance.Options.UseForeColor = true;
            condition2.Condition = FormatConditionEnum.Between;
            condition2.Value1 = "0";
            condition2.Value2 = "0";
            this.gridView2.FormatConditions.AddRange(new StyleFormatCondition[] { condition2 });
            this.gridView2.GridControl = this.gridsp;
            this.gridView2.Name = "gridView2";
            this.gridView2.OptionsBehavior.AllowAddRows = DefaultBoolean.True;
            this.gridView2.OptionsBehavior.AllowDeleteRows = DefaultBoolean.False;
            this.gridView2.OptionsBehavior.ReadOnly = true;
            this.gridView2.OptionsView.AutoCalcPreviewLineCount = true;
            this.gridView2.OptionsView.EnableAppearanceEvenRow = true;
            this.gridView2.OptionsView.EnableAppearanceOddRow = true;
            this.gridView2.OptionsView.ShowAutoFilterRow = true;
            this.gridView2.OptionsView.ShowFooter = true;
            this.gridView2.OptionsView.ShowGroupPanel = false;
            this.gridView2.CustomSummaryCalculate += new CustomSummaryEventHandler(this.gridView1_CustomSummaryCalculate);
            this.gridView2.FocusedRowChanged += new FocusedRowChangedEventHandler(this.gridView2_FocusedRowChanged);
            this.gridsp_id.Caption = "id";
            this.gridsp_id.FieldName = "id";
            this.gridsp_id.Name = "gridsp_id";
            this.gridsp_ngay.Caption = "Ng\x00e0y";
            this.gridsp_ngay.FieldName = "ngay";
            this.gridsp_ngay.Name = "gridsp_ngay";
            this.gridsp_ngay.Visible = true;
            this.gridsp_ngay.VisibleIndex = 0;
            this.gridsp_sophieu.Caption = "Số phiếu";
            this.gridsp_sophieu.FieldName = "sophieu";
            this.gridsp_sophieu.Name = "gridsp_sophieu";
            this.gridsp_sophieu.Visible = true;
            this.gridsp_sophieu.VisibleIndex = 1;
            this.repositoryItemTextEdit3.AutoHeight = false;
            this.repositoryItemTextEdit3.Name = "repositoryItemTextEdit3";
            this.repositoryItemTextEdit3.ReadOnly = true;
            this.repositoryItemTextEdit4.AutoHeight = false;
            this.repositoryItemTextEdit4.DisplayFormat.FormatString = "n0";
            this.repositoryItemTextEdit4.DisplayFormat.FormatType = FormatType.Numeric;
            this.repositoryItemTextEdit4.EditFormat.FormatType = FormatType.Numeric;
            this.repositoryItemTextEdit4.Mask.EditMask = "n0";
            this.repositoryItemTextEdit4.Mask.MaskType = MaskType.Numeric;
            this.repositoryItemTextEdit4.Name = "repositoryItemTextEdit4";
            this.btnin.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
            this.btnin.Image = (Image) manager.GetObject("btnin.Image");
            this.btnin.Location = new Point(0x22d, 0x1c8);
            this.btnin.Name = "btnin";
            this.btnin.Size = new Size(0x4e, 0x17);
            this.btnin.TabIndex = 0x20;
            this.btnin.Text = " &In phiếu";
            this.btnin.Click += new EventHandler(this.btnin_Click);
            this.label28.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.label28.Font = new Font("Tahoma", 10f);
            this.label28.Location = new Point(0x22b, 0x4e);
            this.label28.Name = "label28";
            this.label28.Size = new Size(0x53, 0x13);
            this.label28.TabIndex = 2;
            this.label28.Text = "Nh\x00f3m KH:";
            this.label28.TextAlign = ContentAlignment.TopRight;
            this.cbbnhomkh.Anchor = AnchorStyles.Right | AnchorStyles.Top;
            this.cbbnhomkh.Location = new Point(0x27b, 0x4c);
            this.cbbnhomkh.Name = "cbbnhomkh";
            this.cbbnhomkh.Properties.Buttons.AddRange(new EditorButton[] { new EditorButton(ButtonPredefines.Combo) });
            this.cbbnhomkh.Properties.Columns.AddRange(new LookUpColumnInfo[] { new LookUpColumnInfo("id", "id"), new LookUpColumnInfo("ten", "T\x00ean ph\x00f2ng") });
            this.cbbnhomkh.Size = new Size(0x7b, 20);
            this.cbbnhomkh.TabIndex = 7;
            this.cbbnhomkh.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.gridds_tongtien.Caption = "Th\x00e0nh tiền";
            this.gridds_tongtien.ColumnEdit = this.repositoryItemTextEdit2;
            this.gridds_tongtien.FieldName = "tiensauthue";
            this.gridds_tongtien.Name = "gridds_tongtien";
            this.gridds_tongtien.Summary.AddRange(new GridSummaryItem[] { new GridColumnSummaryItem(SummaryItemType.Sum, "tiensauthue", "Tổng: {0:n0}") });
            this.gridds_tongtien.Visible = true;
            this.gridds_tongtien.VisibleIndex = 7;
            this.gridds_tongtien.Width = 0x5f;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
//            base.AutoScaleMode = AutoScaleMode.Font;
            base.Controls.Add(this.groupControl1);
            base.Controls.Add(this.numnamsinh);
            base.Controls.Add(this.nummiengiam);
            base.Controls.Add(this.numthue);
            base.Controls.Add(this.ctrdanhsach_vp);
            base.Controls.Add(this.tbnumthanhtien);
            base.Controls.Add(this.tbnumsoluong);
            base.Controls.Add(this.tbnumtongmiengiam);
            base.Controls.Add(this.tbnumtongthucthu);
            base.Controls.Add(this.tbnumtongtien);
            base.Controls.Add(this.tbnumtienthue);
            base.Controls.Add(this.tbnumtuoi);
            base.Controls.Add(this.tbnumsotien);
            base.Controls.Add(this.tbnumdongia);
            base.Controls.Add(this.cbbnhomkh);
            base.Controls.Add(this.cbbgioitinh);
            base.Controls.Add(this.datehandung);
            base.Controls.Add(this.datengay);
            base.Controls.Add(this.txtdiachi);
            base.Controls.Add(this.txthoten);
            base.Controls.Add(this.txtsophieu);
            base.Controls.Add(this.txtma);
            base.Controls.Add(this.gridds);
            base.Controls.Add(this.btnketthuc);
            base.Controls.Add(this.btnxoa);
            base.Controls.Add(this.btnin);
            base.Controls.Add(this.btnhuy);
            base.Controls.Add(this.btnboqua);
            base.Controls.Add(this.btnsua);
            base.Controls.Add(this.btnluu);
            base.Controls.Add(this.btnmoi);
            base.Controls.Add(this.btnthem);
            base.Controls.Add(this.txttenhoatchat);
            base.Controls.Add(this.txtten);
            base.Controls.Add(this.label13);
            base.Controls.Add(this.label14);
            base.Controls.Add(this.label2);
            base.Controls.Add(this.txtlosx);
            base.Controls.Add(this.txtvitrikhoten);
            base.Controls.Add(this.txthangsx);
            base.Controls.Add(this.txtdvt);
            base.Controls.Add(this.label10);
            base.Controls.Add(this.label20);
            base.Controls.Add(this.label26);
            base.Controls.Add(this.label18);
            base.Controls.Add(this.label9);
            base.Controls.Add(this.label28);
            base.Controls.Add(this.label19);
            base.Controls.Add(this.label25);
            base.Controls.Add(this.label6);
            base.Controls.Add(this.label17);
            base.Controls.Add(this.label8);
            base.Controls.Add(this.label23);
            base.Controls.Add(this.label1);
            base.Controls.Add(this.label24);
            base.Controls.Add(this.label3);
            base.Controls.Add(this.label16);
            base.Controls.Add(this.label7);
            base.Controls.Add(this.label12);
            base.Controls.Add(this.label5);
            base.Controls.Add(this.label4);
            base.Controls.Add(this.lblmaso);
            base.Controls.Add(this.label22);
            base.Controls.Add(this.label15);
            base.Controls.Add(this.label21);
            base.Name = "ucd_xuatkho_banle";
            base.Size = new Size(0x400, 0x1e2);
            base.Load += new EventHandler(this.ucDMSanPham_Load);
            base.KeyDown += new KeyEventHandler(this.ucDMSanPham_KeyDown);
            this.repositoryItemTextEdit2.EndInit();
            this.txtma.Properties.EndInit();
            this.txtten.Properties.EndInit();
            this.txtdvt.Properties.EndInit();
            this.gridView1.EndInit();
            this.repositoryItemTextEdit1.EndInit();
            this.gridds.EndInit();
            this.txtsophieu.Properties.EndInit();
            this.txthoten.Properties.EndInit();
            this.txttenhoatchat.Properties.EndInit();
            this.txthangsx.Properties.EndInit();
            this.datengay.Properties.VistaTimeProperties.EndInit();
            this.datengay.Properties.EndInit();
            this.txtdiachi.Properties.EndInit();
            this.numthue.EndInit();
            this.txtlosx.Properties.EndInit();
            this.datehandung.Properties.VistaTimeProperties.EndInit();
            this.datehandung.Properties.EndInit();
            this.txtvitrikhoten.Properties.EndInit();
            this.cbbgioitinh.Properties.EndInit();
            this.numnamsinh.EndInit();
            this.nummiengiam.EndInit();
            this.groupControl1.EndInit();
            this.groupControl1.ResumeLayout(false);
            this.datetungay.Properties.VistaTimeProperties.EndInit();
            this.datetungay.Properties.EndInit();
            this.datedenngay.Properties.VistaTimeProperties.EndInit();
            this.datedenngay.Properties.EndInit();
            this.gridsp.EndInit();
            this.gridView2.EndInit();
            this.repositoryItemTextEdit3.EndInit();
            this.repositoryItemTextEdit4.EndInit();
            this.cbbnhomkh.Properties.EndInit();
            base.ResumeLayout(false);
        }

        private void nummiengiam_Validated(object sender, EventArgs e)
        {
            try
            {
                this.tbnumtongmiengiam.Values = (this.tbnumtongtien.Values * this.nummiengiam.Value) / 100M;
                this.tbnumtongthucthu.Values = this.tbnumtongtien.Values - this.tbnumtongmiengiam.Values;
            }
            catch
            {
            }
        }

        private void numnamsinh_Validated(object sender, EventArgs e)
        {
            try
            {
                this.tbnumtuoi.Values = Convert.ToInt16((int) (DateTime.Now.Year - Convert.ToInt16(this.numnamsinh.Value)));
            }
            catch
            {
            }
        }

        private void numthue_Enter(object sender, EventArgs e)
        {
            this.numthue.Select(0, this.numthue.Value.ToString().Length);
        }

        private void tbnumslsang_Validated(object sender, EventArgs e)
        {
            try
            {
            }
            catch
            {
            }
        }

        private void tbnumsoluong_Validated(object sender, EventArgs e)
        {
            try
            {
                this.tbnumsotien.Values = this.tbnumsoluong.Values * this.tbnumdongia.Values;
                this.tbnumtienthue.Values = (this.numthue.Value / 100M) * this.tbnumsotien.Values;
                this.tbnumthanhtien.Values = this.tbnumsotien.Values + this.tbnumtienthue.Values;
            }
            catch
            {
            }
        }

        private void tbnumtuoi_Validated(object sender, EventArgs e)
        {
            try
            {
                this.numnamsinh.Value = DateTime.Now.Year - this.tbnumtuoi.Values;
            }
            catch
            {
            }
        }

        private void txtma_Validated(object sender, EventArgs e)
        {
            try
            {
                DataRow[] rowArray = this.ctrdanhsach_vp.SetDataSource.Select("ma='" + this.txtma.Text + "'");
                this.f_SetControl_dmsanpham(long.Parse(rowArray[0]["id"].ToString()));
                if (rowArray.Length > 0)
                {
                    this.ctrdanhsach_vp.Visible = false;
                }
            }
            catch
            {
            }
        }

        private void txtten_Enter(object sender, EventArgs e)
        {
            this.ctrdanhsach_vp.Width = (this.txttenhoatchat.Location.X + this.txttenhoatchat.Width) - this.txtma.Location.X;
            this.ctrdanhsach_vp.DanhSachCotHienThi_kt = string.Concat(new object[] { this.txtten.Location.X - this.txtma.Location.X, ",", (((this.ctrdanhsach_vp.Width - 0x55) - this.txtten.Location.X) + this.txtma.Location.X) - this.tbnumdongia.Width, ",", 30, ",", this.tbnumdongia.Width, ",50" });
            this.ctrdanhsach_vp.Location = new Point(this.txtma.Location.X, (this.txtma.Location.Y + this.txtma.Height) + 1);
            this.ctrdanhsach_vp.BringToFront();
        }

        private void txtten_KeyDown(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down))
            {
                if (this.ctrdanhsach_vp.Visible)
                {
                    this.ctrdanhsach_vp.Focus();
                }
            }
            else if (e.KeyCode == Keys.Escape)
            {
                this.ctrdanhsach_vp.Visible = false;
            }
            else
            {
                this.ctrdanhsach_vp.Visible = false;
                this.ucDMSanPham_KeyDown(sender, e);
            }
        }

        private void txtten_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (this.txtten.IsEditorActive)
                {
                    this.ctrdanhsach_vp.Visible = true;
                    this.ctrdanhsach_vp.Locdulieu(this.txtten.Text);
                }
            }
            catch
            {
            }
        }

        private void txtten_Validated(object sender, EventArgs e)
        {
            try
            {
            }
            catch
            {
            }
        }

        private void ucDMSanPham_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                SendKeys.Send("{Tab}");
            }
            else if (e.KeyCode == Keys.F2)
            {
                if (this.btnthem.Enabled)
                {
                    this.btnmoi_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F3)
            {
                if (this.btnsua.Enabled)
                {
                    this.btnsua_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F4)
            {
                if (this.btnboqua.Enabled)
                {
                    this.btnboqua_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F5)
            {
                if (this.btnluu.Enabled)
                {
                    this.btnluu_Click(null, null);
                }
            }
            else if (e.KeyCode == Keys.F7)
            {
                if (this.btnhuy.Enabled)
                {
                    this.btnxoa_Click(null, null);
                }
            }
            else if ((e.KeyCode == Keys.F12) && this.btnketthuc.Enabled)
            {
                this.btnketthuc_Click(null, null);
            }
        }

        private void ucDMSanPham_Load(object sender, EventArgs e)
        {
            this._xuatban = new DXuatBanLe(this._xuli.pConFigData);
            this.f_load_gioitinh();
            this.f_load_nhomkh();
            this.datetungay.EditValue = this.datedenngay.EditValue = DateTime.Now;
            this.btntim_Click(null, null);
            this.f_setcontrol_xuatbanle(this._idxuatban);
            this.f_loaddata_xuatbanlect(long.Parse(this.txtsophieu.Tag.ToString()));
            this.f_loadinfo_chidinhchitiet(0);
            this.btnboqua_Click(null, null);
        }
    }
}

